I can\'t get editData or onclickSubmit to do what I need.
I want the grid to follow the added or edited row after update. So, I need to post some additional info so
I think this should do exactly what you want, it changes the postData variable that is sent to the controller, and then triggers a reload.
$('#gridName').jqGrid('setGridParam', { postData: { KeyName: KeyValue } }).trigger('reloadGrid', [{ page: 1}]);
if you need it to go as part of your edit you can do almost the same thing
$(#gridName).jqGrid('editGridRow', rowid, { editData: { KeyName: KeyValue
You can either define properties of editData
using functions
editData: {
sortColumnName: function () { return "ProductName"; },
sortOrder: function () { return "asc"; },
rowNum: function () { return 15; }
}
or use callback onclickSubmit
to extend the data posted to the server
onclickSubmit: function (options, postData) {
return {
sortColumnName: "ProductName",
sortOrder: "asc",
rowNum: 15
};
}
or use serializeEditData
callback
serializeEditData: function (postData) {
return $.extend(true, {}, postData, {
sortColumnName: "ProductName",
sortOrder: "asc",
rowNum: 15
});
}
Every from above ways do the same. You can choose one way which you find the mostly convenient for your requirements.