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
Dynamic colNames, colModel and paging
14/08/2012
19:46
Avatar
lettherebegrid
New Member
Members
Forum Posts: 2
Member Since:
14/08/2012
sp_UserOfflineSmall Offline

I want to use jqGrid with paging and sorting for my asp.net mvc web site. 

My colNames (and therefore colModel) are not known at design time.  They need to be generated at run time.

And each paging of the grid will give me a different set of colNames.

I know that I need to do something like this:

$.ajax({

url: "/Url/To/GetColNamesAndColModels",
        dataType: "json",
        type: 'POST',
        success: function(result) {
               var myColNames = result.ColumnNames;
               var myColModel = result.ColumnModel;

               $("#myGrid").jqGrid({
                        url: '/Url/To/GetData',
                        dataType: 'POST',
                        colModel: myColModel,
                        colNames: myColNames,
                        rowNum: 20,
                        pager: '#myGridPager',
                        viewrecords: true,
                        gridview: true
               });

});

My web service method GetColNamesAndColModels needs to know the sort index (sidx), the sort order (sord), the page index (page) and the page size (rows) as in the standard jqGrid post parameters: (string sidx, string sord, int page, int rows).  How can I can pass such parameters to GetColNamesAndColModels upon paging?

14/08/2012
20:30
Avatar
lettherebegrid
New Member
Members
Forum Posts: 2
Member Since:
14/08/2012
sp_UserOfflineSmall Offline

My test shows that upon paging, my web method at /Url/To/GetColNamesAndColModels will not be hit.  

Any idea on how I can reconstruct colNames and colModel at paging?  Thank you.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
34 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