tags:

views:

136

answers:

1
<table id="gridmain"></table>
<div id="pagermain"></div>

I enabled all Form updating by putting: (Add:true,Edit:true,Delete:true)

But for some records with say: records with the field ConfirmFlag = 1 (the column id is "ConfirmFlag") , I will like to set it such that Editing is not possible (ie, Edit form do not open and possible a dialog to say "Cannot Edit", similar to when no row is selected and the edit button is click). But for other records with ConfirmFlag=0, I will like to open the Edit Form.

May I know how this can be achieved?

Thanks

+1  A: 

If you want to prevent specific rows from being edited, trigger the edit on the onSelectRow instead of setting Edit:true.

  var lastsel2;
  jQuery("#grid").jqGrid({  
    .....
    onSelectRow: function(id){
      if(id && id!==lastsel){
        jQuery('#grid').restoreRow(lastsel);
        if (<condition>) {
        jQuery('#grid').editRow(id,true);
          lastsel=id;
        }
      }
    },
    .....
  });
Vinodh Ramasubramanian