Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
setGridParam problem?
27/05/2009
07:45
Avatar
rocketbob
Member
Members
Forum Posts: 10
Member Since:
27/05/2009
sp_UserOfflineSmall Offline

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 }

            }).trigger("reloadGrid");
        };

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

28/05/2009
03:32
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

28/05/2009
09:26
Avatar
rocketbob
Member
Members
Forum Posts: 10
Member Since:
27/05/2009
sp_UserOfflineSmall Offline

Hi Tony,

Thanks for the help.  After I had posted the message I discovered the unloadgrid method and resolved it exactly as you described.

Regards,

Bob

Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information