问题
Is it possible to tune jqGrid to add some classes to inputs in EditForm? For example, I can add classes to cells by specifying property classes
in colModel
section. And I want to know, is similar mechanism for inputs exist?
回答1:
There are no exact property like classes
in colModel, but you can use dataInit
callback of editoptions to add the class or do other kind of initializing action on the input fields. For example the code
editoptions: { dataInit: function (elem) { $(elem).addClass('ui-state-highlight');
add predefined 'ui-state-highlight' class of jQuery UI (see here) to the input box. As the result you can receive the result like the following

See the demo where I added CSS class 'ui-state-highlight'
to the 'Client'
field and the class 'ui-state-error'
to the 'Tax'
field.
来源:https://stackoverflow.com/questions/8895802/jqgrid-and-custom-classes