I need to update / upload deleted data, and all other operations are performed locally. Then this is how I can achieve my need.
Prepare jqGrid with local data type
$("#jqGridView").jqGrid({ //url: originalUrl,// Original line //datatype: "json",// Original line datatype: "local", // For local sorting sortable: true, // I want local sorting for all columns colNames: [...], colModel: [...], //... });
Then call this function in (re) load / search:
function reloadJqGrid() { var urlForSearch = "xxx"; // modify your search URL (if required) $.get(urlForSearch, function (data) { $("#jqGridView").jqGrid('setGridParam', { datatype: 'local', data: data.Payload //My URL response json is in JSend format, thus storing the array in "data.Payload". You may simply use "data" }) .trigger("reloadGrid"); }); }
Hope this help!
Joe lau
source share