Custom sort for grouped rows
Custom sort for grouped rows
khaos
Posts: 47Questions: 11Answers: 0
Using the following great example:
http://live.datatables.net/nitemova/97/edit
How would we begin to create a sort that works 'within' the grouping.
I think the easiest solution would be to programmatically 'hold' or 'keep' the first sorted column on the grouped column. As we do if we hold shift while sorting secondary, tertiary ... sort columns.
Is this a possibility?
This question has accepted answers - jump to:
Answers
Use
orderFixed
to always order by therowGroup.dataSrc
. Like this:http://live.datatables.net/nitemova/245/edit
Kevin
This is exactly what I wanted. I am so excited I am resisting the juvenile urge fill a screen with "YES!!"
Is there a way to toggle asc/desc on the orderFixed col? (Should this be it's own thread?)
You can use
order.fixed()
to change the fixed order. See this example:http://live.datatables.net/nitemova/246/edit
For it to work properly you will need to turn of end user ordering of the
rowGroup.dataSrc
column, usingcolumns.orderable
and create your own click event for thatth
. In the click event get the current fixed order withorder.fixed()
. reverse the order and set it withorder.fixed()
. Looks like it works but I will leave it to you to fully testKevin
Outstanding! This is once again what I needed.