I am trying to figure out a way to solve an issue with a DataTable set in a Repeater. Depending on the user viewing the page, the number of column changes. For instance User1 will see 8 columns while user2 will see 7 columns in the table.
Datatables lets me choose the default ordering of the table with the order functionality:
var table = $('#example'String).DataTable();
// Sort by column 8 and then re-draw
table
.order( [ 8, 'asc' ] )
The problem is that whenever I change the Visibility of the 1st column for User2:
column0.Visible = False
...the number of column changes, so the correct index to do the odering has change from index 8 to index 7.
I have tried to use the default ordering by <td> ID but it will only accept Colummn Index.
I have tried to use a negative Index to start from the right but it doesn't work.
I also tried to find a way to hardcode the table columns manually without changing the order to the end user.
It would be simple if I could change the order of my columns but they need to be in that specific order on screen.
Anyone familiar with Datatables that can help me with this. It would be highly appreciated :)