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_TopicIcon
How to trigger initial client side sorting
13/05/2012
01:50
Avatar
twilson7755
New Member
Members
Forum Posts: 1
Member Since:
05/05/2012
sp_UserOfflineSmall Offline

I have a grid where the data is loaded once from a server (datatype: json, loadonce: true) and I am able to successfully display the data in the grid and click on the various column headings to trigger sorting.  My problem is that the initial data that is returned from the server is NOT sorted and I would like the grid to perform the initial sorting on the client side without having to click a column heading.

I tried adding the following code to the loadComplete event but it had no effect:

loadComplete: function () {

   $("#list").jqGrid('setGridParam', { sortname: 'Name', sortorder: 'asc' });

   $("#list").trigger("reloadGrid");

},

where 'Name' is the colName that I would like the initial sorting performed on.  Any ideas would be greatly appreciated.

Thanks,

Terry

25/05/2012
22:13
Avatar
Arvind Yadav
Member
Members
Forum Posts: 12
Member Since:
16/11/2011
sp_UserOfflineSmall Offline

Hi,

Define the sortname,sortorder i.e. the column on which you want the default sorting. Then,

Change the datatype of the grid to local on the loadcomplete event of the jqgrid.

2nd option:

1. Fire a ajax call and get the data into a javascript array.

2. Define the jqgrid with datatype local and give the array constructed in step 1 as input to the grid.

3. Define the default sorting column and order

Thanks,

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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