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.
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top