I\'m trying to use jqGrid with local data and I\'m finding a couple of issues:
I\'m initializing the thing like so:
function refreshGrid($grid, results)
Following works for me when refreshing data on an existing grid:
var gridData = [...];
var grid = jQuery('#gridId');
grid.jqGrid('clearGridData');
if( grid.get(0).p.treeGrid ) {
grid.get(0).addJSONData({
total: 1,
page: 1,
records: gridData.length,
rows: gridData
});
}
else {
grid.jqGrid('setGridParam', {
datatype: 'local',
data: gridData,
rowNum: gridData.length
});
}
grid.trigger('reloadGrid');
I had to do it this way because reloadGrid() calls populate(), populate() calls addLocalData() and passes the return value to addJSONData(), but for treeGrid == true, addLocalData() returns nothing, and addJSONData() subsequently does nothing.