Forum



19:11

10/09/2012

I'm using jqGird version : "4.4.0". However, the client side sorting does not work. This is the grid definition:
$(function() {
$("#fileGrid").jqGrid(
{ multiselect:true,
datatype : 'json',
mtype : 'get',
colNames : [ 'FileID', 'File Name', 'Group Name', 'Date Created', 'Date Uploaded', "Upload URL", "Upload Session" ],
colModel : [ {
name : 'id',
jsonmap : 'id',
width : 5,
align : 'center',
hidden:false,
key:true
},{
name : 'fileName',
jsonmap : 'fileName',
width : 30,
align : 'left'
}, {
name : 'groupName',
jsonmap : 'groupName',
width : 10,
align : 'left'
}, {
name : 'createdDT',
jsonmap : 'createdDT',
width : 10,
align : 'left'
}, {
name : 'uploadedDT',
jsonmap : 'uploadedDT',
width : 10,
align : 'left'
}, {
name : 'uploadURL',
jsonmap : 'uploadURL',
width : 10,
align : 'left'
}, {
name : 'uploadSessionID',
jsonmap : 'uploadSessionID',
width : 10,
align : 'left'
}
],
autowidth : true,
viewrecords : true,
gridview : true,
rowNum : -1,
jsonReader : {
repeatitems : false,
root : "rows",
page : "currPage",
total : "totalPages",
records : "totalRecords"
}
//onCellSelect : onCellSelect
});
});
This is how the grid is populated:
function updateFileGrid(result) {
alert("updateFileGrid.result=" + JSON.stringify(result));
/*for (myvar in result) {
alert("updateFileGrid.result.myvar=" + myvar);
}*/
//fileGridData = result;
$("#fileGrid")[0].addJSONData(result);
$("#fileGrid").setGridParam({datatype:'local'});
}
The data displayed by the alert dialog is
updateFileGrid.result={
"currPage":1,
"rows":[{"createdDT":"9/6/12 3:20 PM","fileName":"FnAAAA","groupName":"GrpAAAA","id":"100","uploadSessionID":null,"uploadURL":null,"uploadedDT":null},
{"createdDT":"9/6/12 4:20 PM","fileName":"FnBBBB","groupName":"GrpBBBB","id":"200","uploadSessionID":null,"uploadURL":null,"uploadedDT":null},
{"createdDT":"9/6/12 5:20 PM","fileName":"FnCCCC","groupName":"GrpCCCC","id":"300","uploadSessionID":null,"uploadURL":null,"uploadedDT":null}],
"totalPages":1,
"totalRecords":3}
I need to sort the data on the client side. However, the local (client side) sorting does not work at all. I played around with datatype : 'local', which resulted the data disappear. I added the event handler loadComplete to change the datatype to local, but it is never called.
How can I achieve local sorting of the data when the grid is populated via addJSONData, and there is no url for the the grid?
Your help is appreciated.
Most Users Ever Online: 715
Currently Online:
43 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