Is it possible to disable editing in jqGrid for certain cells in a column that is marked as editable?
From what I've seen, the only options are "all cells are editable" or "no cells are editable". Is there a way to work around this?
Is it possible to disable editing in jqGrid for certain cells in a column that is marked as editable?
From what I've seen, the only options are "all cells are editable" or "no cells are editable". Is there a way to work around this?
I'll recommend you to use so named "Inline Editing" for row editing. The most advantage of this method, that it is very intuitive and the user. You can see how it works on the demo page http://trirand.com/blog/jqgrid/jqgrid.html. Choose on this demo "Row Editing" and then "Using Events" or "Input types" on the left tree part. With this method you can implement any custom verification whether the selected row should be allowed to be edited or not inside of the event handle
onSelectRow
orondblClickRow
. If you allow editing, then you calleditRow
method of jqGrid. This method creates input controls for all editable columns and the user can modify the row values in a natural way. The modifications will be saved if the user press "enter" key or canceled on "esc" key.I personally prefer to implement calling of
editRow
method inside ofondblClickRow
event handler. So the user can continue selecting of rows like usual and can use double click for the row editing. The pseudo code will look like folowing:You can do it logically. You must have some criteria for cells that some cells can be editable and some are not.
I have implemented it row wise.
When you create XML for jqgrid, give some id to each row.
Based on these ids you can make those rows' cells editable or noneditable using jqgrid methods.
Below is beforeEditCell method:
You can further implement yourself.
Hope my suggestion would help you. :)