Forum



21:59

12/04/2010

I have some website buttons that are controlling how jqGrid gets called. Each button group is calling jqgrid with slightly different colModel and onSelectRow operations. What I am trying to find is a real example where someone has used GridDestroy.
In my html source document, I have:
<table id='searchResults'></table>
<div id='gridNavBar'>
</div>
If I use GridUnload, it kills the dynamically generated grid with accompanying data. You can reload the grid but only if you don't change the column model. Cool.
But with GridDestroy, as I read it in the jqGrid documentation, goes deeper than 'Unload' in that it would remove my table id='searchResults' and my div id='gridNavBar' from the DOM. And according to the documentation, it also unhooks my jqGrid functionality that was connected to my id 'searchResults'. So my question is, how do I reinitiate a new grid with different column model if GridDestroy is going to kill my targeted id (searchResults)???
Here is what I am working with so far.
var munitionType = jQuery('#searchResults').jqGrid('getGridParam','xmlReader:row');
if (jQuery('#searchResults').children().length > 0) { // grid already built
if (munitionType == 'chem') { // checks for correct munitions group xml file loaded
jQuery("#searchResults").jqGrid('setGridParam',{url:"weaponLib/chem_riot.xml"}).trigger("reloadGrid");
}
else {
alert('grid loaded but wrong munitions group xml loaded');
/*jQuery('#searchResults').jqGrid('GridDestroy', '#gbox_searchResults'); // destroys the grid
jQuery("#searchResults").jqGrid('setGridParam',{url:"weaponLib/chem_riot.xml"}).trigger("reloadGrid");*/
}
}
else {
alert("grid not built");
// build a brand new grid from scratch
}
});
20:15

12/03/2013

I have similar issues while using it with JQuery Mobile.
Grid does not refresh the data properly(it only display few coloumn) once I revisit code with new data for the grid
Note that I display grid propery first time.
calling a method to create a grid as follows:
createGrid();
$("#grid").trigger("reloadGrid"); // id "grid" defined for <table id=grid>
$.mobile.changePage( $page, options ); createGrid();
and method, as follows:
var createGrid = function displayGrid(){
jQuery('#grid').jqGrid({
"jsonReader":{"repeatitems":false,"subgrid":{"repeatitems":false}},
"datatype":"local",
data:sortedMyInfluAarry,
"gridview":true,
.............
...........
colNames:[, , , , , , , ],
"colModel":[ , , , , , ,]
});
}
Most Users Ever Online: 715
Currently Online:
63 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66