Forum
00:14
15/12/2011
I have a couple issues with column sorting that I would like to see if there is a workaround for.
- 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?
- 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.
00:34
10/08/2009
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
or like
Whether such look will be supported by jqGrid as new feature should decide Tony.
Best regards
Oleg
00:58
15/12/2011
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.
18:13
14/02/2012
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 ?
19:49
Moderators
30/10/2007
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.
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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66