It is posible to order columns independently

It is posible to order columns independently

nuwanda555nuwanda555 Posts: 1Questions: 1Answers: 0

I wonder if you can display independent information in each column and sort the columns individually, so that if you order one column the others are not affected

thanks in advance

Answers

  • kthorngrenkthorngren Posts: 21,166Questions: 26Answers: 4,921

    That is not a builtin feature of Datatables. It would take a bit of doing but its possible to write your own sorting function. You will probably want to disable the user's ability to order the table with ordering then add your own click events to the header. When the header is clicked you can use column().data() to get the data for the column, you can sort it appropriately then loop through the rows with rows().every() or maybe cells().every() and rewrite the sorted data for that column.

    Don't recall this question being asked before so not sure if there are examples. But you could search the forum if you haven't already.

    There may be other better options that the developers may suggest.

    Kevin

This discussion has been closed.