I have a grid with many columns that cover two (roughly) types of data - stuff that can be loaded quickly and stuff that takes longer. I'm wanting to display the grid when the fast data is finished and then render the slow columns as they arrive from ajax calls.
I've been trying to use the loadComplete fn to know when the fast data is finished so I can send out the ajax calls for the rest of the data but I'm running into two problems:
- Even though I'm calling
$('#grid').trigger('reloadGrid');
only 3 of 20 rows actually get updated - Every time I page-forward / page-back the loadComplete event occurs. This means all the ajax for that page gets called again.
The grid is defined as follows:
$("#list2").jqGrid({
url: "hosts.php",
datatype: "json",
colModel: [
// columns defined here
],
pager: "#pager2",
viewrecords: true,
sortorder: "asc",
gridview: true,
autoencode: true,
ignoreCase : true,
loadonce : true,
width: "500px",
height: "auto",
shrinkToFit: false,
jsonReader: {
repeatitems: false,
root: "rows"
},
loadComplete: function( data )
{
// call 'slow data' ajax here
});
How would I accomplish such a two-phase initialization? And how would I make sure that the data only gets loaded 1x?
EDIT:
jqGrid - version 4.6.0
Data(columns): host information - includes name, kernel version, CPU type, etc.
"Slow" data - sparklines, host scripts, etc
Should I update my jqGrid version?
Could I use a method like this (@joedoyle)? The trick in either case will be to load the displayed page once and only once.