I'm using jqGrid 4.3.2 with the inlineNav
option. All editing on the grid is done locally using loadonce: true
and clientArray
. When the user finishes editing, they click a save button on the form and the entire grid is posted to the server. This works great, for the most part, but I've run into an oddity. If the user adds a new row and then clicks the save button before hitting enter to confirm the edit or deselecting the newly added row, the add button on the inline navigator remains disabled even after calling saveRow
before posting and reloading. I've tried resetSelection
and restoreRow
after the saveRow
call, but neither of these work. My save code:
$("#submitButton").click(function () {
$("#theGrid").jqGrid('saveRow', $("#selectedRowId").val(), false, 'clientArray');
if (!ValidateGridData())
return false;
var rowData = $("#theGrid").jqGrid('getRowData');
var dataToSend = JSON.stringify(rowData);
$.ajax({
url: '@Url.Action("UpdateGridData")',
type: 'POST',
contentType: 'application/json; charset=utf-8',
data: dataToSend,
dataType: 'json',
async: false,
success: function (data, textStatus, jqXHR) {
$("#theGrid").jqGrid('setGridParam', { datatype: 'json' });
$("#theGrid").trigger('reloadGrid');
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Error saving data: ' + textStatus + " " + errorThrown);
}
});
return true;
});
Is there a way I can convince the inline navigator that the new row is saved and the user can add more rows?
replace
on theattr('class')
instead of.removeClass
. Works perfectly. Thanks! – Hymanhymen