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_Related Related Topics sp_TopicIcon
addJSONData with client side sort
10/09/2012
19:11
Avatar
jqgridsort910
New Member
Members
Forum Posts: 1
Member Since:
10/09/2012
sp_UserOfflineSmall Offline

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.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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