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
Problems with Column Sorting
18/01/2012
00:14
Avatar
GrandSlambert
Hudson, WI
Member
Members
Forum Posts: 4
Member Since:
15/12/2011
sp_UserOfflineSmall Offline

I have a couple issues with column sorting that I would like to see if there is a workaround for.

  1. When a column is marked as unsortable, the column header still highlights on hover and still has the cursor as the others do for sorting. I would like neither to happen when sorting. Why does jqGrid ad the 'ui-jqgrid-sortable' class to columns that are not sortable?
  2. On the columns that I can sort, I want to change the sorting icons and always display them. We use a double arrow to indicate that a column can be sorted, and a single up or down arrow to indicate which column the data is currently sorted on and whether the sort is asc or desc. I am sure I can change the icons easily, but do not see how I can make the double arrows show when the column is not sorted.

Thanks in advance for any advice.

18/01/2012
00:34
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

I understand the problem. I described the workaround in the old answer. To display the sorting icons on the sortable columns always you can follow my other recent answer. You will get the grid like

Image Enlarger

or like

Image Enlarger

Whether such look will be supported by jqGrid as new feature should decide Tony.

Best regards
Oleg 

18/01/2012
00:58
Avatar
GrandSlambert
Hudson, WI
Member
Members
Forum Posts: 4
Member Since:
15/12/2011
sp_UserOfflineSmall Offline

Well, that takes care of a big part of it. The column headers still change colors on the hover which they should not do. Your example sends me in the right direction though so I will keep working on it.

Now the problem is that jqGrid uses two different spans for the up and down arrows, so I cannot do what I want in 1 above. The rest of the site uses a larger up or down arrow on the sorted column, and the smaller double arrow on unsorted columns. I will have to play with the CSS more I guess.

14/02/2012
18:13
Avatar
GV
India
New Member
Members
Forum Posts: 1
Member Since:
14/02/2012
sp_UserOfflineSmall Offline

from grid-base.js

line:2124  sort = ts.p.colModel[j].sortable;
line:2125  if( typeof sort !== 'boolean') {ts.p.colModel[j].sortable = true; sort=true;}
line:2126  var nm = ts.p.colModel[j].name;
line:2127 if( !(nm == 'cb' || nm=='subgrid' || nm=='rn') ) {
line:2128  if(ts.p.viewsortcols[2]){
line:2129    $("div",this).addClass('ui-jqgrid-sortable');
line:2130    }
line:2131 }
line:2132 if(sort) {
line:2133  ///adding sort icon
line:2134  ///adding sort icon
line:2135 }

=============

Changed

line:2124  sort = ts.p.colModel[j].sortable;
line:2125  if( typeof sort !== 'boolean') {ts.p.colModel[j].sortable = true; sort=true;} 
line:2126  var nm = ts.p.colModel[j].name; 
line:2127 if(sort) {
line:2128 if( !(nm == 'cb' || nm=='subgrid' || nm=='rn') ) {
line:2129  if(ts.p.viewsortcols[2]){ 
line:2130    $("div",this).addClass('ui-jqgrid-sortable');
line:2131    } 
line:2132 } 
line:2133  ///adding sort icon
line:2134  ///adding sort icon
line:2135 }

I checked for a while, and its working.. Can anyone please tell me whether this will have some other unforeseen effects ?

14/02/2012
19:49
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

Thanks Oleg for the example - I will see if I can include it.

The reason for these settings is simple - using the current approach the sorting can be changed dymamically with just a simple command

$("#grid").jqGrid('setColProp', 'colname', {soratable: false});

I find this feature more important than not to have sortable cursor.

In the Oleg's link here there is some very simple solution

th.unsortableclass {

cursor: default;

}

Apply this cass to the not sortable columns.

Regards

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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