【问题标题】:JqGrid and custom classesJqG​​rid 和自定义类
【发布时间】:2012-01-17 13:55:30
【问题描述】:

是否可以调整 jqGrid 以向 EditForm 中的输入添加一些类?例如,我可以通过在colModel 部分中指定属性classes 来向单元格添加类。我想知道,是否存在类似的输入机制?

【问题讨论】:

    标签: jquery css jqgrid


    【解决方案1】:

    colModel 中没有像classes 这样的确切属性,但是您可以使用editoptionsdataInit 回调来添加类或对输入字段执行其他类型的初始化操作。例如代码

    editoptions: { dataInit: function (elem) { $(elem).addClass('ui-state-highlight');
    

    将 jQuery UI 的预定义“ui-state-highlight”类(参见here)添加到输入框。结果,您可以收到如下结果

    参见the demo,我在'Client' 字段中添加了CSS 类'ui-state-highlight',在'Tax' 字段中添加了'ui-state-error' 类。

    【讨论】:

      猜你喜欢
      • 2014-08-27
      • 2012-12-25
      • 1970-01-01
      • 2011-02-25
      • 2013-05-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-24
      • 2011-07-03
      相关资源
      最近更新 更多