Forum
July 12th, 2025
A
A
A
Topic RSS
Related Topics
Offline
The forums are currently locked and only available for read only access
Topic RSS
Related Topics
Not able to sort columns
Tags: Not able to sort columns
12/05/2011
16:37
16:37
santoshvk
Bangalore
Member
Members
Forum Posts: 5
Member Since:
11/05/2011
11/05/2011
OfflineHi,
In My Asp.net project
I am not able to sort on the columns
function successFunction(jsondata) {
var jsonObj = JSON.parse(jsondata.d);
var stringObj = "{total:'',page:'',records:'',rows:[";
for (var itr = 0; itr < jsonObj.length; itr++) {
stringObj += "{ id:'" + itr + "',";
stringObj += " cell:[";
stringObj += "'" + jsonObj[itr].Empid + "',";
stringObj += "'" + jsonObj[itr].Name + "',";
stringObj += "'" + jsonObj[itr].Age + "'";
stringObj += "]";
if (itr == jsonObj.length - 1) {
stringObj += "}";
}
else {
stringObj += "},";
}
}
stringObj += " ]}";
var thegrid = jQuery("#JqGridBody")[0];
thegrid.addJSONData(JSON.parse(stringObj));
}
function getProducts() {
$.ajax({
url: "Default.aspx/GetJsonDataFromService",
data: "{}",
dataType: "json",
type: "POST",
async: false,
contentType: "application/json",
success: successFunction,
error: function (data) { alert(data); }
});
}
function LoadJqGrid() {
jQuery("#JqGridBody").jqGrid({
datatype: getProducts,
colNames: colHeader,
colModel: colBody,
rowNum: 10,
rowList: [5, 10, 20, 50, 100],
jsonReader:
{
root: "rows",
page: "page",
total: "total",
records: "records",
repeatitems: true,
cell: "cell",
id: "id",
userdata: "userdata",
subgrid:
{
root: "rows",
repeatitems: true,
cell: "cell"
}
},
pager: '#JqGridPager',
sortorder: "desc",
multiselect: false,
viewrecords: true,
treeGrid: true,
ExpandColumn: 'name',
caption: "Json Data"
})
.filterToolbar()
.navGrid('#JqGridPager', { edit: true, add: true, del: true });
}
Forum Timezone: Europe/Sofia
Most Users Ever Online: 994
Currently Online:
9 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
Log In
Home