Note that there are some explanatory texts on larger screens.

plurals
  1. POjqGrid: navGrid reloadAfterSubmit does not add a new row when editurl is not valid
    primarykey
    data
    text
    <p>I am trying to test adding a new row and deleting a row in jqGrid and I find that the grid does not refresh to show the new row or remove the deleted row after adding/deleting a row. The server side piece is not in place yet for adding/deleting, so I just fed editurl the same url I used to load data into the grid. </p> <pre><code>.navGrid('#' + id + '-pager', {addtext: 'Add Code Value', deltext: 'Delete Code Value', edit:false,add:true,del:true,search:false, refresh:false}, {closeAfterAdd: true, reloadAfterSubmit: true} /* Edit options */, {closeAfterAdd: true, reloadAfterSubmit: true} /* Add options */, {reloadAfterSubmit: true} /* Delete options */); </code></pre> <p>Am I missing something here? I thought reloadAfterSubmit should update the grid with the added/deleted row?</p> <p>Thanks.</p> <p><strong>Edited</strong>: My custom add function, which is unnecessarily complicated is (note: this should be a client side add only) </p> <pre><code>addfunc = function() { //Find dirty unsaved row if any and add to the grid before adding empty row var dirtyRow = jQuery('#' + id).find('tr[editable]'); var dirtyRowId = dirtyRow.attr('id'); if (dirtyRow.length &gt; 0) { dirtyRow.addClass('data-isDirty', true); var rowData = jQuery('#' + id).jqGrid('getRowData', dirtyRowId); jQuery('#' + id).jqGrid('addRowData', rowId, dirtyRowId); //The row when added to the grid should not be editable but a normal row dirtyRow.find('input').each(function() { var text = jQuery(this).attr('value'); jQuery(this).replaceWith(text); }); } var rowId = Math.floor(Math.random()*1000) + 'add_new'; jQuery('#' + id).jqGrid('addRowData', rowId, that.getEmptyRow(colModel), 'first'); var firstRowId = jQuery('#' + id).jqGrid('getDataIDs')[0]; //Add an empty editable row at the top jQuery('#' + id).jqGrid('editRow', firstRowId); } </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
    1. This table or related slice is empty.
    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