0

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

4

1 回答 1

0

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.

于 2012-05-08T10:01:01.563 回答