Forum
07:45
27/05/2009
I'm building a grid dynamically, as I don't know the colModels and colNames collections until runtime. I set those when creating the grid and and it works just fine. However, I have a select on the page where the user can set a different database query, thus requiring a refresh of the colNames and colModels collections, then reloading the grid. This isn't working, and I get a 'undefined' is null or not an object on line 756 of grid.base.js (3.5 beta 2.) The colModel array apparently is not being updated when I call setGrid like this:
$.fn.RefreshMyDataGrid = function(gridData) {
$("#MyDataGrid").setGridParam({
postData: { ObjectName: $('#selAvailableViews').val(), colNames: gridData.columnNames, colModel: gridData.columnModels }
};
gridData is an object containing the colNames and colModels arrays, and works fine when initially loading the grid. How can I refresh those properties and reload the grid if this doesn't work?
Regards,
Bob
03:32
Moderators
30/10/2007
Hello,
jqGrid does not support dynamically loading configuration per request.
In order to do this you should first GridUnload and then recreate the grid.
With setGrid param this will not work
Suppose the grid is initially configured
$("#mybutton").click(function(){
$("#mygrid").GridUnload(); // destroy the grid saving the table and pager
// here code to load new jqGrid configuration - like colmodel, colnames and etc
var newjqgridoptions = .....
$("#mygrid").jqGrid(newjqgridoptions);
return false;
})
Hope this help
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
43 Guest(s)
Currently Browsing this Page:
1 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