C # allows you to reserve a word that will be used as the name of the property using the at sign . eg.
// In ASP.NET MVC, we use @class to define
// the css class attribute for some HtmlHelper methods.
var htmlObject = new { readonly = "readonly", @class = "ui-state-highlight" }
I want to do the same in JavaScript. eg.
function makeGrid(grid, pager) {
grid.jqGrid({
caption: 'Configurations',
colNames: ['Id', 'Name'],
colModel: [
{ name: 'Id', index: 'Id' },
{ name: 'Name', index: 'Name', editable: true,
editoptions: { readonly: 'readonly', class: 'FormElement readonly' } },
],
pager: pager,
url: 'www.example.com/app/configurations") %>',
editurl: 'www.example.com/app/configurations/edit") %>'
}).navGrid(pager, { edit: true, add: false, del: false, search: false }, {}, {}, {});
}
Note class: 'FormElement readonly' should set the value of the css class in the jqGrid editing dialog box, but IE errors on the reserved word.
Is there an escape character in JavaScript? #class? @ class? & class? Otherwise, how can I tell jqGrid to set the css class in a popup editor? Thank.