2

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:

  1. Even though I'm calling $('#grid').trigger('reloadGrid'); only 3 of 20 rows actually get updated
  2. 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.

Community
  • 1
  • 1
ethrbunny
  • 10,379
  • 9
  • 69
  • 131
  • 1) **It's important to know which fork of jqGrid (old jqGrid version <=4.7, [free jqGrid](https://github.com/free-jqgrid/jqGrid) or [Guriddo jqGrid JS](http://guriddo.net/?page_id=103334)) and in which version you use.** 2) It would be good is you post an example of data and `colModel` which you use. For example 3 "quick" loadable columns and 2 "slow" columns 3) How many total rows (you use `loadonce: true` so the server returns all data at once) and columns ("slow") you have? – Oleg Jul 03 '15 at 14:12

0 Answers0