Why is error 404 for editurl: "clientData" when deleting the second row from jqGrid?

Referring to a slightly modified version of the jqGrid local editing demo by @Oleg located here: http://www.dataactive.net/local_editing.htm ... after deleting a single row using the trash can icon on the bottom toolbar or the Delete button The following error is shown on the top toolbar in Firebug: "NetworkError: 404 Not Found - http://www.dataactive.net/clientArray "

@ Can you find out why this is happening?

Now that this problem has been resolved with deleting a line, something else I am observing (bearing in mind that this is editing "local data"), when newly added rows are deleted, they do not seem to disappear. Consider the code myDelOptions from your demo (@Oleg), which I am trying to use in another script for production purpose:

myDelOptions = { // because I use "local" data I don't want to send the changes // to the server so I use "processing:true" setting and delete // the row manually in onclickSubmit onclickSubmit: function (options, rowid) { var grid_id = $.jgrid.jqID(grid[0].id), grid_p = grid[0].p, newPage = grid_p.page; // reset the value of processing option to true to // skip the ajax request to 'clientArray'. options.processing = true; // delete the row grid.delRowData(rowid); $.jgrid.hideModal("#delmod" + grid_id, { gb: "#gbox_" + grid_id, jqm: options.jqModal, onClose: options.onClose }); $("#list")[0].refreshIndex(); setTimeout(function () { $("#list").trigger("reloadGrid", [{ current: true}]); }, 100); calculateTotal(); if (grid_p.lastpage > 1) {// on the multipage grid reload the grid if (grid_p.reccount === 0 && newPage === grid_p.lastpage) { // if after deliting there are no rows on the current page // which is the last page of the grid newPage--; // go to the previous page } // reload grid to make the row from the next page visable. grid.trigger("reloadGrid", [{ page: newPage}]); } return true; }, processing: true }; 

the calculateTotal() function, which iterates through the row object, simply accepts the numeric values ​​of the row columns that remain, and recounts them into a footer row, but it happens that iterating through the grid row object shows that the “deleted” rows are still present in an array or something like that, and therefore it is impossible to calculate a new amount, because nothing has changed, the rows are not actually deleted. I don’t understand what actually happens when “delRowData” is used in the context of local data, but it seems to only “delete” the row from the visual grid, but it is still part of the row object. And even stranger, if you add another new line, the “deleted” lines will appear again exactly the same as in the new line. As you can see, I have refreshIndex[0] and trigger(reload) , but the line is not deleted if trigger("reload") is, and refreshIndex[0] does not work. Can anyone address this? Need extra code?

+2
source share
1 answer

You're right. Thanks! An example trick is to set processing: true as part of myDelOptions . On the first delete operation, everything is OK, but the value will be reset to processing: false other part of the delGridRow method on the second call.

The fix is ​​very simple: just add an extra line

 options.processing = true; 

inside onclickSubmit myDelOptions . See Modified Demo here .

+2
source

All Articles