How to remove a built-in delete action in JQGrid

I tried to modify a sample from this question jQGrid Custom Action http://ok-soft-gmbh.com/jqGrid/TestSamle/Admin1.htm to remove an action like this:

ondblClickRow: function (id, ri, ci) { //... $("div.ui-inline-edit", tr).hide(); //... }, onSelectRow: function (id) { //... $("div.ui-inline-edit", tr).show(); //... } loadComplete: function () { $("div.ui-inline-del", tr).hide(); } 

But it doesn’t help.

How can I do this?

+2
source share
3 answers

It seems to me that you should first hide all the "del" icons inside the loadComplete , and then add the afterSave and afterRestore formatoptions formatting options formatting actions :

 formatter: 'actions', formatoptions: { keys: true, // we want use [Enter] key to save the row and [Esc] to cancel editing afterSave: hideDelIcon, afterRestore: hideDelIcon } 

Where

 var hideDelIcon = function(rowid) { setTimeout(function() { $("tr#"+$.jgrid.jqID(rowid)+ " div.ui-inline-del").hide(); },50); }; 

See the modified demo here .

+1
source

What about formatoptions: {..., delbutton: false, ...}?

http://www.trirand.net/documentation/php/_2v70wa4jv.htm

+12
source

you can add this:

  $('.ui-inline-del').each(function(index) { $(this).html(''); }); or this: $('.ui-inline-del').each(function(index) { $(this).hide(); }); 

at the end of loadComplete: function () { also change

 .jqGrid('navGrid', '#Pager1', { add: true, edit: false }, {}, {}, myDelOptions, { multipleSearch: true, overlay: false }); 

in

 .jqGrid('navGrid', '#Pager1', { add: true, edit: false, del:false }, {}, {}, myDelOptions, { multipleSearch: true, overlay: false }); 

if you want to remove the delete row option in the footer

+1
source

All Articles