Is there an easy way to get the current column order when a column is moved?

Is there an easy way to get the current column order when a column is moved?

thegamechangerprothegamechangerpro Posts: 81Questions: 30Answers: 1

What I am looking for is a way to fire an action (kind of like an on-click) when a column is moved (reordered) that returns the current column order. I am guessing I need to use column.order.listener() but I don't quite get how to use it and I can't find any examples in use.

I was hoping to accomplish a similar function when the visibility is changed for a column as well. (This one i feel may be easier if I know how to attach an on-click to the visibility column buttons).

A little context:
I have multiple users that use a dataTable in different ways. Through the software I am using I can initially set the dataTable with user conditions every time they open the table if I so choose. I just need to get the changes made from the dataTable
Once I do that I am able to save it the preferences to the employee's user record in the software. This saves the user from having to reorder and hide column to their liking every time they open the table.

This question has an accepted answers - jump to answer

Answers

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

    What I am looking for is a way to fire an action (kind of like an on-click) when a column is moved (reordered) that returns the current column order.

    Sounds like you will want to use the column-reorder event.

    I was hoping to accomplish a similar function when the visibility is changed for a column as well.

    Look at the column-visibility event.

    Through the software I am using I can initially set the dataTable with user conditions every time they open the table if I so choose. I just need to get the changes made from the dataTable

    Take a look at stateSave and the options/callbacks in the Related section of the docs. You might also be interested in the StateRestore extension.

    Kevin

Sign In or Register to comment.