How can I save the sort state of a table and pass it to another?

How can I save the sort state of a table and pass it to another?

TK1TK1 Posts: 2Questions: 1Answers: 0

I have a table where the user can click on the various columns to sort. I want to save their sort selection and then pass it to another table. For example, if the user sorts table 1 by column A, I want that pass that column A information to another method. I know I can use the statesave option for saving the sort options for a specific table, but I do not know how to pass that information to another object.

Any insight or help would be greatly appreciated.

Answers

  • TK1TK1 Posts: 2Questions: 1Answers: 0

    I figured it out and am sharing in case anyone else runs into the same question. To get the current sort state you use table.fnSettings().aaSorting

  • allanallan Posts: 61,853Questions: 1Answers: 10,134 Site admin

    To get the current sort state you use table.fnSettings().aaSorting

    Ooo - no :-). The settings object is private. Its properties, can, do and will change between versions! Avoid it if you possibly can!

    Use the public API to get what you need whenever you can - order() in this case.

    Allan

This discussion has been closed.