How to disable editing for some cells in JQGrid row editing?

When I click on any row of my grid, all editable columns become editable.

I want some of the columns to be edited on each row separately.

Column 1, Column 2, Column 3 ROW Number 1 - editable, non-editable, non-editable ROW Number 2 - non-editable, editable, non-editable ROW Number 3 - editable, non-editable, non-editable 

Thanks at Advance

+5
javascript jqgrid
Oct 11 '11 at 9:01
source share
2 answers

If you use the built-in editing mode and want to dynamically decide which cells in the row will be edited, for example, based on the contents of the cell, you can do this as I described here . You can do this with another method:

 $(this).jqGrid('setColProp', 'YouColumnName', {editable:false}); 

Therefore, before calling the editRow method , you should simply set editable to false or true . In the method, you can implement any logic that you need.

UPDATE: Free jqGrid allows you to define editable as a callback function. See the wiki article . It allows you to make a column editable in some rows and keep it uneditable for other rows.

+11
Oct 11 2018-11-21T00:
source share

I had a similar requirement, simply extending what Oleg already mentioned in his answer:

 //get colModel properties var cm = jQuery("#grid").jqGrid('getColProp','myColumn'); //some condition to enable or disable editing cm.editable = false; //always call editRow after changing editable property jQuery('#grid').jqGrid('editRow', rowId, {}); //set default editable option cm.editable = true; 

Greetings :)

0
Aug 26 '15 at 8:35
source share



All Articles