Sort a visible Column based on a hidden column

Sort a visible Column based on a hidden column

MLUCKHAMMLUCKHAM Posts: 2Questions: 1Answers: 0

Is it possible to sort a visible column based on a hidden column? I have a table where I display a date and time entry in a short format, but I have a hidden column with the full date stored. I would like to sort the table when the user clicks on the visible date column, but based on the contents of the hidden date column...

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,343Questions: 26Answers: 4,954
    Answer ✓

    Use columns.orderData for this.

    Kevin

  • MLUCKHAMMLUCKHAM Posts: 2Questions: 1Answers: 0

    Thanks Kevin. This looks great. My thinking is for dates, rather than try and navigate the pretty complex options for date sorting, I present a hidden column with the date and time converted to an integer and sort on that.

    On the examples shown, it states "orderData": [ 0, 1 ], "targets": 0 - I assume the orderData is the columns to sort and target is the column to sort on. So in my case if the date column was column 0, and the integer column was column 1 and hidden, I would use orderData: [0[, target 1?

Sign In or Register to comment.