I have the following code to enter inline editing with a double click:
ondblClickRow: function (row_id) { if(row_id != null) { $('#Products').jqGrid('restoreRow',last_selected_row); $('#Products').jqGrid('saveRow',row_id); $("#Products").jqGrid('editRow',row_id, true, null, function(){ $("#Products").trigger("reloadGrid", [{current: true}]); }, 'xtras/Products.php', null,{}, {},{} ); $("#Products_ilsave").removeClass('ui-state-disabled'); $("#Products_ilcancel").removeClass('ui-state-disabled'); $("#Products_ilcancel").removeClass('ui-state-disabled'); $("#Products_ilcopy").addClass('ui-state-disabled'); $("#Products_iladd").addClass('ui-state-disabled'); } }
and navigation definition:
$("#Products").jqGrid("navGrid", "#Products_pager", {search: true, add: false, edit: false, del: true, refreshstate: "current"}, {}, {}, {}, {}, {sopt:['eq','ne','cn','bw','bn','ge','le','lt','gt'], multipleSearch:true, showQuery: false} ) .jqGrid("inlineNav", "#Products_pager", {add: true, edit: true}, ) .navButtonAdd('#Products_pager',{ caption:"", title:"Copy selected row", id:"Products_ilcopy", buttonicon:"ui-icon-copy", onClickButton: function(){ var srcrowid = $grid.jqGrid('getGridParam', 'selrow'); if (srcrowid > 0) { $('#Products_iladd').click(); var rowData = $('#Products').jqGrid('getRowData', srcrowid); rowData.ID = ''; rowData.Catalogue = ''; rowData.UPCEAN = ''; rowData.copyID = srcrowid; $grid.jqGrid('setRowData', 'new_row', rowData); var ondblClickRowHandler = $('#Products').jqGrid("getGridParam", "ondblClickRow"); ondblClickRowHandler.call($("#Products")[0], 'new_row'); } else { alert('Please select a row to copy'); return false; } }, position:"last" });
As you can see, when I press the COPY button, a new line is called and ondblClickRow to introduce inline editing. If I press the SAVE button in navGrid , it will save, but not restart. If I press Enter, it will reboot, but will not save anything.
How can I save and reload the grid, please?
-------------- UPDATE ---------------------
add, edit, delete, copy - all the same URL - 'xtras / Products.php'
url:'xtras/Products.php', editurl:'xtras/Products.php', datatype: "json", mtype:'GET',
$ ('# Products') - the only grid on the page
using - jqGrid 4.4.2