Programmatically set the 'readonly' attribute of the editoptions options in jqGrid column

无人久伴 提交于 2019-12-25 08:24:14

问题


I'm using jqgrid's form editing feature.

Can I programmatically set the readonly attribute of the editoptions options in the jqgrid?

I need to determine if as specific field would be readonly or not, depends on one of the current row cell value.

Thanks


回答1:


You can set readonly attribute inside of beforeShowForm on the field (see here) or alternatively you can set/remove readonly: 'readonly' property (see here) of the editoptions for the column inside of beforeInitData which will be called before the edit form will be created. You can use setColProp for example to change editoptions (see here an example).

To implement the changes depends on the cell value from some column you need just get the id of selected row with respect of getGridParam and then get the cell value using getCell (see here).

In any cases I recommend you to use recreateForm: true option of form editing. It should be default options in my opinion.



来源:https://stackoverflow.com/questions/10496057/programmatically-set-the-readonly-attribute-of-the-editoptions-options-in-jqgr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!