keep grouping while sorting on various cols- bug in example??
keep grouping while sorting on various cols- bug in example??

I need to be able to group rows on a particular column (it can be visible). Easy enough, using drawcallback as in the example:
https://datatables.net/examples/advanced_init/row_grouping.html
Now, I need to be able to maintain the grouping at all times, even when I click on other column headers. In the case of the rowgrouping example cited above, I'd like to click on the Name column and still have the groups, but the rows would be ordered by name, click on the Start Date and have them in Start Date order while still in groups, etc. The Edinburgh group would always be at the top, for example.
The example is pretty close to what I need. Currently, if you click the "Age" header, the whole table sorts by age, but you lose the groups. However, if you click any of the group rows, it reverts to the grouping with the rows sorted by age, within the group. Sweet!
Now- how would I make this happen automatically without the intervening step of no grouping? And by the way, I'm always going to want descending order on the column that I sort by, rather than ascending.
Thanks for any help on this.
Replies
Use the
orderFixed
option to specify a column to always be ordered first.Allan
Allan-
Thanks very much! orderFixed solved my problem. You may want to consider adding that to the online demo because I think this is the functionality most people would want when doing row grouping.
And I'm adding "orderSequence": [ "desc" ] to my columns to force descending order when first clicked- works great. Thanks!
Actually- a minor glitch. On columns on which I set orderSequence, I now do not get a cursor pointer when I mouse over those headers- I get the i-beam cursor. Kinda weird? Here is the table. See anything funny?
Seems to work okay here: http://live.datatables.net/nabokoku/1/edit .
Can you link to a test case showing the issue or modify that example please?
Allan
Ok- I modified your code to be exactly what is in your row grouping example. Then I added "orderFixed": [2, 'asc']. So far so good.
Then, I made col 3 (Age) default to desc like this:
... and now, if you mouseover the Age header, you will see the cursor change to I beam.
Got it! Oddly, my example does actually show the issue on Chrome / Mac, but I was using Chrome / Linux yesterday and worked as expected there...
Anyway, I see the problem and have committed a fix. The nightlies will update with the change soon.
Regards,
Allan
Allan-
When will this fix be in the cdn? I'm pulling in:
https://cdn.datatables.net/v/dt/jqc-1.12.3/moment-2.13.0/dt-1.10.12/b-1.2.2/fh-3.1.2/sc-1.4.2/se-1.2.0/datatables.min.css
Thanks
Not sure when DataTables 1.10.13 is going to be released yet. There are a few other things I need to tidy up as well, so it likely won't be too far away. Perhaps the end of the month, but I don't have a committed shipped schedule for it yet.
Allan