Hi,
I'm trying to implement the colReorder function along with order and colVis functions.
Problem is that if I move a column, the indexes returned from order or colvis functions is the original one and not the actual one.
For example, consider a table with 3 columns (id 0, 1 and 2), column 0 contains internal data so it's hidden by default and not considered in the colVis columns, I order column 2 and then switch it with column 1:
- before moving column, table.settings().order()
returns [ 2, "asc" ]
- after column has been moved i expect to receive [ 1, "asc" ]
, but I get [ 0, "asc" ]
So, if I save table.settings().order()
's result to the database and then use it back on next table initialization, everything is messed up. I've menaged to solve this replacing the returned index with table.colReorder.transpose(idx)
in a for cycle, but is this really the way to go?
With colVis is even worst and I don't even know how to work around it. In the same scenario as above, if I select from the dropdown menù the column number 2, it remains visible, column 0 becomes visible between column 2 and 1, column 1 remains visible.
I've set up a demo for you: https://jsfiddle.net/0yc8sd1z/. Please, switch the 2 columns and then try to hide the column "Office".