Serial GridUnload createGrid not working

Any ideas why several calls to the function performing the following

grid.jqGrid('GridUnload');
createGrid();

Will create the grid only at another time, but ...

The following will work every time it is called:

grid.jqGrid('GridUnload');
setTimeout(createGrid, 1000);
+1
source share
1 answer

You do not include the code createGrid, so I can only guess. One possible reason is that you are using inside a variable grid. If you use GridUnload, the old item <table>will be deleted and the other will be created in the same place. Thus, you should reset the value gridafter the call GridUnload:

var gridId = grid[0].id; // or grid.attr('id');
grid.jqGrid('GridUnload');
grid = $('#' + $.jgrid.jqID(gridId)); // or just $('#' + gridId);
createGrid();

The method $.jgrid.jqIDyou should use only if the idgrid can contain a meta character .

+2
source

All Articles