When I use $('#mygrid').jqGrid('GridUnload');
my grid is destroyed: no pager/ no header.
In a wiki I found:
The only difference to previous method is that the grid is destroyed, but the table element and pager (if any) are left ready to be used again.
I can't find any difference between GridUnload/ GridDestroy or do I something wrong?
I use jqGrid 3.8.
It deletes all elements which belong to the grid inclusve the <table> element. The method GridUnload on the other hand delete all, but the empty <table> element stay on the page. So you are able to create new grid on the same place.
Free jqGrid is a JavaScript plugin that displays table-based data in a lot of different configurations. The data can be loaded from JavaScript array or be loaded from the server (in JSON or XML format). It supports client-side paging, sorting and filtering on server-side.
Just set opacity:0 for jqgrid element. it will work also.
To be able to create jqGrid on the page you have to insert an empty <table>
element on the place of the page where you want see the grid. The simplest example of the table element is <table id="mygrid"></table>
.
The empty <table>
element itself will be not seen on the page till you call $('#mygrid').jqGrid({...})
and the grid elements like column headers will be created.
The method GridDestroy
works like jQuery.remove. It deletes all elements which belong to the grid inclusve the <table>
element.
The method GridUnload
on the other hand delete all, but the empty <table>
element stay on the page. So you are able to create new grid on the same place. The method GridUnload
is very usefull if you need create on one place different grids depend on different conditions. Look at the old answer with the demo. The demo shows how two different grids can by dynamically created on the same place. If you would be just replace GridUnload
in the code to GridDestroy
the demo will be not work: after destroying of the first grid no other grids will be created on the same place.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With