Is there a way of displaying a "sorted by" summary in the "info" feature?
Is there a way of displaying a "sorted by" summary in the "info" feature?
dbunge
Posts: 7Questions: 2Answers: 0
Currently, this is on an intranet site so I cannot show an example.
When I click on the columns to sort, the arrows highlighted as expected, but if I shift-click and add a secondary sort, it's not apparent how the table is being sorted since it's sorted by one column and then a secondary column.
So, I'm wondering if there is a plugin or other option which would show more verbose details about the sorting.
Thank you
This question has an accepted answers - jump to answer
Answers
I would look at using
infoCallbackfor this. In the callback useorder()to get the current ordering.Kevin
It's a cool idea for a plugin that. You could listen for the
infoevent and modify the info there.Another option, if you want a more visual representation of the applied sort is to use the plugin presented here.
Allan
Its good practice for me to try little plugins now and then, so here is one which adds the column name to the info element: https://live.datatables.net/xatimufo/1/edit .
You just need to add
infoOrderto the initialisation options.Things to add: details about ordering direction, and support for multiple column ordering.
Allan
I had to make some tweaks, as mentioned, but I now have a "Ordered by" working.
Good stuff! Here is my example updated with your plugin code.
Thanks for sharing that with us.
Allan