Posts tagged jqGrid

Disable jqGrid data load on initialization

0

I have a jqGrid in a tab that is initalized on page load, but at that time the tab is not visible yet. Because the tab is not visible, the grid JSON data should not be loaded right after grid initialization. It’s not very intuitive to get this done, but it’s quite easy to do!

Set the grid attribute:

datatype: local

If the tab is clicked the following code must be executed to load the Grid data:

$('#my-jqgrid-ID')     .jqGrid('setGridParam', { 'datatype' : 'json' })     .trigger('reloadGrid');

Reload jqGrid

0

Today I was looking for the method to reload the JSON data of jqGrid.

With firebug I selected some element the grid was in with:

$('.ui-jqgrid', '#tab-ínfo').trigger('reloadGrid');

I chose .ui-jqgrid because that was one of the classes of the grid container. But this doesn’t work! The grid table tag is the element that has the actual grid ID. In order to get the generic code above work, we have to add the table element.

$('.ui-jqgrid table', '#tab-ínfo').trigger('reloadGrid');

And now it works as expected!

Go to Top