Note that there are some explanatory texts on larger screens.

plurals
  1. POjqGrid inline edit: how to save again if post returns error
    primarykey
    data
    text
    <p>jQgrid row is edited using inline editing mode. Pressing Enter sends data to server using http POST . POST method returns status 400 Bad reguest if there was some error. errorofunc in code below show error in this case. User corrects data in row and presses enter again.</p> <p>Pressing enter is ignored, nothing happens. It looks like Enter key is unbound if 404 error is returned. Changes in edited row are lost, they cannot saved.</p> <p>I tried to set in errorfunc</p> <p>restoreAfterError = false; grid.restoreAfterErorr = false;</p> <p>but row still cannot saved again after error.</p> <p>How to allow to save correct row data after 400 error is returned ?</p> <pre><code>&lt;script type="text/javascript"&gt; var lastSelectedRow; $(function () { var grid = $("#grid"); grid.jqGrid({ url: '/Grid/GetData', datatype: "json", mtype: 'POST', scroll: 1, multiselect: true, multiboxonly: true, scrollingRows : true, autoencode: true, colModel: [ { name: 'Source', fixed: true, editable: true, width: 30 }, { name: 'Est', fixed: true, editable: true, width: 271 }, { name: 'Istopic', fixed: true, editable: true, width: 57 }, {name: 'Critical', fixed: true, editable: true, width: 50} ], gridview: true, pager: '#pager', sortname: 'est', viewrecords: true, rowNum: 30, sortorder: "asc", editurl: '/Grid/Edit' }); $("#grid").jqGrid('bindKeys', { onEnter: function(rowid) { doeditRow(rowid); } } ); }); function doeditRow(rowID) { var grid2 = $("#grid"); if (rowID &amp;&amp; rowID !== lastSelectedRow) { grid2.jqGrid('restoreRow', lastSelectedRow); lastSelectedRow = rowID; } invokeEditRow(); } function errorfunc(rowID, response) { // todo: why this does not allow Enter key to continue ase after error: restoreAfterError = false; $("#grid").restoreAfterErorr = false; alert(response.responseText); lastSelectedRow = rowID; invokeEditRow(); return true; } function invokeEditRow() { $("#grid").jqGrid('editRow', lastSelectedRow ,true,null, null, null, {}, null, errorfunc ); } &lt;/script&gt; &lt;div id="grid1container" style="width: 100%;"&gt; &lt;table id="grid"&gt; &lt;/table&gt; &lt;div id="pager"&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <blockquote> <p>UPDATE: errrofunc calls editrow which according to <a href="https://github.com/tonytomov/jqGrid/blob/master/js/grid.inlinedit.js" rel="nofollow">https://github.com/tonytomov/jqGrid/blob/master/js/grid.inlinedit.js</a> should set enter key again to save. For unknown reason this does not occur.</p> </blockquote> <p>UPDATE: in errorfunc grid. is changed to </p> <pre><code> $("#grid").restoreAfterErorr = false; </code></pre> <p>according to Oleg comment</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload