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?
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
Sounds like you will want to use the
column-reorder
event.Look at the
column-visibility
event.Take a look at
stateSave
and the options/callbacks in theRelated
section of the docs. You might also be interested in the StateRestore extension.Kevin