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?

dbungedbunge Posts: 1Questions: 1Answers: 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

Answers

  • kthorngrenkthorngren Posts: 22,286Questions: 26Answers: 5,125

    I would look at using infoCallback for this. In the callback use order() to get the current ordering.

    Kevin

  • allanallan Posts: 65,162Questions: 1Answers: 10,796 Site admin

    It's a cool idea for a plugin that. You could listen for the info event 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

  • allanallan Posts: 65,162Questions: 1Answers: 10,796 Site admin

    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 infoOrder to the initialisation options.

    Things to add: details about ordering direction, and support for multiple column ordering.

    Allan

Sign In or Register to comment.