jqGrid contains columns defined in colmodel as
{"name":"_actions",
"formatoptions":{"editbutton":true,"keys":true
,"delbutton":true
} },
{ "name":"Kood","editable":true,"hidden":true}
New row is added to grid pressing inline add button in toolbar. After data in saved, controller returns new Kood column value. This new value should assigned to Kood column.
Code below shows two methods which I tried but both fail. Kood column values does not change
How to update column after inline add ? How to update column also if inline added row is saved using save action button ?
$grid.jqGrid('inlineNav', '#grid_toppager', {
addParams: {
addRowParams: {
keys: true,
// This is called if enter key is pressed to save added row
aftersavefunc: afterSaveFuncAfterAdd,
}
},
editParams: {
keys: true,
// This is called if saver button in toolbar is pressed on inline add
aftersavefunc: afterSaveFuncAfterAdd,
},
add: true,
edit: false,
save: true,
cancel: true
});
function afterSaveFuncAfterAdd(rowID, response ) {
var json = $.parseJSON(response.responseText);
postData = $grid.jqGrid('getGridParam', 'postData');
// this shows correct value:
alert(json.PrimaryKeyValues[0]);
// attempt 1:
$('#' + rowID + '_Kood').val(json.PrimaryKeyValues[0]);
// attempt2:
postData['Kood'] = json.PrimaryKeyValues[0];
}
loadonce: trueor full work with the server data only? - Oleg$tr.attr("id", json.Id). However column value cannot set. - Andrus