Forum
17:27
09/07/2013
Hi,
great work with the grid so far.
Although, after upgrading to 4.5.2 and setting multiSort to true, I cant seem to be able to sort the grid with multiple columns by code.
i.e:
jQuery("#grid").jqGrid('setGridParam', { sortname: "Field1 asc, Field2", sortorder: "asc" }).trigger('reloadGrid');
or
jQuery("#grid").jqGrid('sortGrid', "Field1 asc, Field2", true, "asc");
or any combination of the two actually.
Im using local data (by calling 'addRowData')
Will this be possible in the near future?
Thank you.
btw: the reloadGrid trigger is not working in this case, and when sorting via the GUI you can only sort by left->right order of the columns (i.e can sort by field2, field3 and then by field5, but cant field5, field2 and then by field3).
Although i saw posts regarding these issues already.
11:47
Moderators
30/10/2007
Hello,
Thanks for this. Will maybe improve sortGrid function.
Currently in order to achieve this you will need to call sortGrid (in multiSort set to true) several times like this.
jQuery("#grid")
.jqGrid('sortGrid', "Field1″, true, "asc")
.jqGrid('sortGrid', "Field2″, true, "desc");
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.
11:43
09/07/2013
Seems to be working, thanks alot!
Right now to walk around of the grid not minding the sort order i ask, i have to set each ColModel[index].lso to the opposite order.
And also, have to set the ColModel.firstsortorder to "desc", due to a bug that the multiSort function does this:
} else { cm[iCol].lso = so = cm.firstsortorder || 'asc'; }
instead of this (i think...)
} else { cm[iCol].lso = so = cm[iCol].firstsortorder || 'asc'; }
Hope you fix that too,
Thanks for the help.
16:41
Moderators
30/10/2007
Hello,
Thank you very much. Fixed in GitHub
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.
11:56
10/02/2014
Hi guys, I am using the jqgrid multisort for a project. My requirement is to sort the grid using a minimum of 1 and a maximum of 3 colums and always in ascending order. At the moment, when I am using the following method,
/*
jQuery("#grid")
.jqGrid('sortGrid', "Field1″, true, "asc")
.jqGrid('sortGrid', "Field2″, true, "asc");
*/
sorting happens correctly for the first time, but on second sort jqgrid automatically gets sort in descending order and on the 3rd sort the original condition (presort state) of jqgrid is restored. Please suggest me some way of fulfilling this requirement.
Thanks and Regards.
14:34
Moderators
30/10/2007
Hello,
Should I understand that you execute the above code several times - i.e with asc parameter. How do you call the second and third sorting?
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.
16:27
10/02/2014
Hi Tony, thanks for such a quick reply!
This is how I have am doing it on my jsp -
When the user wants to sort the grid on multiple columns, she has to press a sort button provided on the screen. This will take her to a pop up window where all the columns of the grid by the name are shown. From these columns, she can select 1, 2 or 3 columns for sorting. An 'ok' button on the pop up will take her back to the main page. After this I execute the rest of the method. If she had selected only one field for sorting, I execute the follwing -
jQuery("#grid").jqGrid('sortGrid', "Field1″, true, "asc");
If she had selected 2 fields then I execute the following -
jQuery("#grid").jqGrid('sortGrid', "Field1″, true, "asc").jqGrid('sortGrid', "Field2″, true, "asc");
If she had selected 3 fields then I execute the following -
jQuery("#grid").jqGrid('sortGrid', "Field1″, true, "asc").jqGrid('sortGrid', "Field2″, true, "asc").jqGrid('sortGrid', "Field3″, true, "asc");
Now when she does any of these three actions for the very first time, everything is executed correctly, however if she tries to execute the 3rd action, for instance, second time, even though I have explicitley mentioned 'asc' as the sort criteria, the grid would sort in descending order and when the same action is done for a 3rd time the grid is restored to it's first time load state(unsorted state). After this the cycle repeats itself.
Hope this will help you in detecting the root cause of the problem.
Thanks again!
12:57
Moderators
30/10/2007
Hello,
It seems that there is a problem with this. I will try to fix this for the upcomming release (very soon)
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.
15:22
10/02/2014
Hi Tony, I was able to implement my requirement by using 'GridUnload' for destroying the previous sorting cirteria and order. But I have run into another problem. It seems, at least to me, that jqgrid always gives precedence to the left most column while sorting with multiSort : true.
I mean even if I am executing the following command -
jQuery("#grid").jqGrid('sortGrid', "Field1″, true, "asc").jqGrid('sortGrid', "Field2″, true, "asc");
where I would expect the outcome to be a grid sorted on "Field1" first and then on "Field2", the outcome is this only when "Field1" is on the left of "Field2". Whenever the "Field1" is on the right of "Field2" the actual outcome will be a grid sorted on "Field2" first and then on "Field1".
Kindly tell me, whether my observation is a mistake from my end or is it actually a part of the behaviour of jqgrid and if it's a part of the behaviour of jqgrid, whether a work around exists or not?
Thanks a ton btw
22:07
30/05/2014
Hi Tony, Even i am facing same problem just like steve. jqgrid always gives precedence to left most column for multisort.i was looking in detail at jquery.jqgrid.js for multi sort and what i felt that it always look at in colmodel sequence to append sort name . line 2239
ts.p.sortorder = "";
         $.each(cm, function(i){
            if(this.lso) {
               if(i>0 && fs) {
                  sort += ", ";
               }
               splas = this.lso.split("-");
               sort += cm[i].index || cm[i].name;
               sort += " "+splas[splas.length-1];
               fs = true;
               ts.p.sortorder = splas[splas.length-1];
            }
         });
         ls = sort.lastIndexOf(ts.p.sortorder);
         sort = sort.substring(0, ls);
         ts.p.sortname = sort;
ts.p.sortname = sort; - this is always will be Left columm asc/desc, Right column asc/desc
No matter if you have sort order with Field2(right col), Field1(left col).
Â
I also tried to change ts.p.sortname to proper sequence based on header click, though data is not sorting the way we click header. it always sorts left column and then right column.
Am i missing something here? trying to fix that issue but no luck. do you have any updates?
17:19
Moderators
30/10/2007
Hello,
This will be updated and additionally to that there will be a possibility to define the multisort in way the user click on the column - i.e we will not count it from left to right.
Kind 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.
12:11
Moderators
30/10/2007
Hello,
You can use diffrent editors - just go in your proffil and select BBcode editor if you have problem with this.
Also you can use GitHub to post changes.
Thank you.
Kind 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:
66 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