tags:

views:

348

answers:

1

I have a jqgrid in a modal popup that has data dependent on some input. I am doing this by setting the url option of the grid based on the input like below then showing the popup:

$(ContainerGrid.Grid).setGridParam({
    url: urlGetContainers + '?CRALineId=' + currentCRALineId
}).reloadGrid();

When the grid is first loaded on the screen, it isn't being displayed and no data needs to be retrieved until the modal popup is shown. Unfortunately, the jqgrid still tries to make a request to get data based on its url option.

I've tried using the hiddengrid property to hide/collapse the grid initially, which also keeps it from making a request for data. This didn't work, though, because I couldn't find a programmatic way show/expand the grid.

Is there any way to suppress the jqgrid from initially loading data?

+4  A: 

Initialize your grid in the 'Show' event of the modal popup. You can dynamically generate the jqGrid and insert it into the DOM, and then late-bind the data using the normal initialization code.

The Matt
Nice! I just have to make sure I don't initialize more than once if the popup is opened multiple times but it works.
JChristian