Reputation: 4193
Any ideas why multiple calls to a function that does the following
grid.jqGrid('GridUnload');
createGrid();
Will only create the grid every other time, but ...
The following will work everytime it is called:
grid.jqGrid('GridUnload');
setTimeout(createGrid, 1000);
Upvotes: 2
Views: 1614
Reputation: 221997
You don't included the code of createGrid
so I can only guess. One possible reason is that you use grid
variable inside. If you use GridUnload
the old <table>
element will be deleted and another one will be created on the same place. So you should reset the value of grid
after call of GridUnload
:
var gridId = grid[0].id; // or grid.attr('id');
grid.jqGrid('GridUnload');
grid = $('#' + $.jgrid.jqID(gridId)); // or just $('#' + gridId);
createGrid();
The method $.jgrid.jqID
you have to use only if the id
of the grid can hold some meta-character.
Upvotes: 3