Forum


19:46

14/08/2012

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?
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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66