orderMulti when columnDef has orderData set
orderMulti when columnDef has orderData set

http://live.datatables.net/lujuvuwu/5/edit?js,output
- Sort by Age
- Shift+Click the Name field to also apply sort by it
- Shift+Click the Name field again to change the sort direction
Notice there was no movement. I believe this is due to the configuration of the applied orderData, since Age (column 3) is configured with orderData: [3,0]
.
I'm curious how to break the column definitions when multiOrder is engaged. In the example the columns are sorting how I expect them to by default. Sorting any field would first sort that field, then sort by the person's name. But if I shift+click any other field, I'd only want to sort by the columns involved in the multisort, ignoring the initial orderData.
Does this make sense? If so, is there a native way to implement this type of behavior?
Answers
Hi @vol7ron ,
That's not possible, I'm afraid. The
orderData
would always have an additional sort of that first column, the name, so that's why you're seeing the behaviour you are.An alternative perhaps would be to use the
order
, and add an additional order on withorder()
. You would need a check to ensure the event doesn't loop by also doing it with your additional one, but that could be a global flag that gets set.Hope that helps,
Cheers,
Colin
@colin Thank you for your reply.
The interesting thing is I think this was not an issue in older versions of DataTables (1.9) -- atleast, the behavior always worked as expected. I'm trying to isolate what the difference was, but I've made so many changes through the version upgrade, that I'm not exactly user. I think it has something to do with a sortData
I've made so many changes that it would take some time to isolate the differences, though I started to confuse myself because the old version contained mixtures of various sort/order fields. Consider these: