简体   繁体   中英

how to set some rows un editable in jqgrid?

is there way to set some rows un editable in jqgrid after first edit is done

i tried to add class

not-editable-row

but no luck

this is how i make all rows editable

onSelectRow: function(id){
  if(id && id!==lastsel){
    grid.jqGrid('restoreRow',lastsel);
    grid.editRow(id,true);
    lastsel=id;
  }
}

any help would be great

Thanks

You don't posted the code which you use to add the 'not-editable-row' class to the row ( <tr> element).

I suppose that what you need is just do this inside of aftersavefunc event handler of the editRow . So you should replace the grid.editRow(id,true) to the following:

grid.jqGrid('editRow',id,true,null,null,null,{},
            function(rowid){
                var tr = this.rows.namedItem(rowid);
                $(tr).addClass('not-editable-row');
            });

See the demo .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM