【问题标题】:Programmatically set the 'readonly' attribute of the editoptions options in jqGrid column以编程方式设置 jqGrid 列中 editoptions 选项的“只读”属性
【发布时间】:2012-05-08 09:32:22
【问题描述】:

我正在使用 jqgrid 的表单编辑功能。

我可以在jqgrid 中以编程方式设置editoptions 选项的readonly 属性吗?

我需要确定特定字段是否为readonly,这取决于当前行单元格值之一。

谢谢

【问题讨论】:

    标签: javascript jquery jqgrid options


    【解决方案1】:

    您可以在字段上的beforeShowForm 内设置readonly 属性(请参阅here),或者您可以为内部列设置/删除editoptionsreadonly: 'readonly' 属性(请参阅here)的beforeInitData 将被称为之前编辑表单将被创建。例如,您可以使用setColProp 更改editoptions(参见here 示例)。

    要实现更改取决于某个列中的单元格值,您只需获取与getGridParam 相关的选定行的ID,然后使用getCell 获取单元格值(请参阅here)。

    在任何情况下,我都建议您使用recreateForm: true 表单编辑选项。在我看来,它应该是默认选项。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-08-20
      • 1970-01-01
      • 2017-10-23
      • 2017-08-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-29
      相关资源
      最近更新 更多