You're right. There seems to be a bug in formatter:"actions"
current version of jqGrid. If you look at the source code , you will not find any variable that stores information about the last line of editing. Therefore, depending on the implementation of your code that uses formatter:"actions"
, you may have either a few lines of editing:

or at least the wrong icons in the old edit line

and you will no longer be able to edit the previous edit icon (because you donβt have the βeditβ action icon).
In the demo, I propose, as a workaround, to cancel the previous edited unsaved row in both the onSelectRow
jqGrid event and the onEdit
formatter:'actions'
event. The corresponding code snippet is as follows
var grid=$("#list"), lastSel, cancelEditing = function(myGrid) { var lrid; if (typeof lastSel !== "undefined") { // cancel editing of the previous selected row if it was in editing state. // jqGrid hold intern savedRow array inside of jqGrid object, // so it is safe to call restoreRow method with any id parameter // if jqGrid not in editing state myGrid.jqGrid('restoreRow',lastSel); // now we need to restore the icons in the formatter:"actions" lrid = $.jgrid.jqID(lastSel); $("tr#" + lrid + " div.ui-inline-edit, " + "tr#" + lrid + " div.ui-inline-del").show(); $("tr#" + lrid + " div.ui-inline-save, " + "tr#" + lrid + " div.ui-inline-cancel").hide(); } }; grid.jqGrid({ // ... colModel:[ {name:'act',index:'act',width:55,align:'center',sortable:false,formatter:'actions', formatoptions:{ keys: true, delOptions: myDelOptions, onEdit: function (id) { if (typeof (lastSel) !== "undefined" && id !== lastSel) { cancelEditing(grid); } lastSel = id; } }}, ... ], onSelectRow: function(id) { if (typeof (lastSel) !== "undefined" && id !== lastSel) { cancelEditing($(this)); } lastSel = id; } });
In the demo, I use inline editing by double-clicking on the grid line in addition to formatting the actions. This is not required, but both can work together without any conflict.
source share