Reputation: 2451
I have following event binding code. When i try to save the row the event function gets fired but i do not get any row data? i have to get entire data and iterate to locate id. Is this correct???
$("#jqGrid").bind("jqGridInlineAfterSaveRow", function (e, rowid, orgClickEvent) {
console.log("[Start]jqGridInlineAfterSaveRow");
console.log(rowid);
console.log(orgClickEvent);
console.log(e);
var data = $("#jqGrid").jqGrid('getGridParam', 'data');
$.each(data, function(index, item){
if(item._id_ === rowid){
console.log(item);
}
});
console.log("[End]jqGridInlineAfterSaveRow");
return e.result === undefined ? true : e.result;
});
Upvotes: 1
Views: 432
Reputation: 221997
Please include always the information about the version of jqGrid, which you use (can use), and the fork (free jqGrid, commercial Guriddo jqGrid JS or an old jqGrid in version <=4.7).
In any way the parameters
$("#jqGrid").bind("jqGridInlineAfterSaveRow",
function (e, rowid, jqXhrOrBool, postData, options) {
var item = $(this).jqGrid('getLocalRow', rowid);
//...
}
);
Where the 3-d parameter is Boolean in case of saving of local data and jqXHR in case of saving data to the server via Ajax request. The parameter postData
contains the modified data, which you probably need. If you feed all data about the row instead of only editable fields, then you can use getLocalRow
to get the reference to the item of internal data
, which represent full local row data.
I tested just now the event jqGridInlineAfterSaveRow
in free jqGrid 4.13.6, which I develop, and the event really contains the parameters, which I described above.
Upvotes: 3