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
After re-ordering columns, sorting maps data to original columns
17/01/2013
22:53
Avatar
earachefl
Member
Members
Forum Posts: 10
Member Since:
04/01/2012
sp_UserOfflineSmall Offline

I've been tearing my hair out on this one. Whether I try to implement column re-ordering via header dragging or via the column chooser plugin, after re-ordering the columns, clicking on any column header to sort results in the sorted columns being loaded into their original positions in the table. I've tried the suggestions posted here but nothing seems to work. Using the sortable method:

sortable: {

options: {

stop: function(event, ui){

// have tried putting the remapcolumns function inside stop() to no avail 

$("#mainGrid").jqGrid("remapColumns", [0,1,2,3,4,5,6,7,8,9,10,11,12], true);

}

},

update: function (perm) {

  /*

 * code to save the new colmodel goes here

*/

// the following line doesn't seem to do anything... just seems to return an array identical to 'perm'

$("#mainGrid").jqGrid("getGridParam", "remapColumns");

// if included, the next line causes the headers to not move

$("#mainGrid").jqGrid("remapColumns", perm, true); 

// this alternate allows them to move, but the newly sorted columns still get remapped to their original position

$("#mainGrid").jqGrid("remapColumns", [0,1,2,3,4,5,6,7,8,9,10,11,12], true);

}

}

After reordering, I can see that the data is being returned from the server in the expected order after sorting. What am I missing? 

BTW, this is using jqGrid 4.4.1.

17/01/2013
23:37
Avatar
earachefl
Member
Members
Forum Posts: 10
Member Since:
04/01/2012
sp_UserOfflineSmall Offline

Finally stumbled on the solution. I needed to pass the original order of the columns as an array to remapColumns, and also include the last param.:

sortable: {

update: function (perm) {

$("#mainGrid").jqGrid("remapColumns", [0,1,2,3,4,5,6,7,8,9,10,11,12], true, false);

}

},

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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