column.visible() & state.save()
column.visible() & state.save()
monkeyboy71
Posts: 5Questions: 1Answers: 0
I have stateSave enabled on my table. And I have a JS function that enables toggling of column visibility.
But... I can't get the column visibility states to save.
I have tried manually triggering a state.save() after any column.visible() change, but that didn't do it.
How might I get a column change to save in the state settings?
Thanks for the advice.
This discussion has been closed.
Answers
Doesn't calling "table.state.save();" in your toggle function take care of it?
It does not. And I'm not sure if it's either a) not calling or b) being overwritten on table initialization on reload.
I should note, the toggle consists of checkboxes, hences the onChange bind.
Additionally, I tested the stateSaveCallback() to make sure the correct values were getting submitted via stateSave and the are all in there. I am not sure where stateSave writes to so I'll go track that down and check it out. Or maybe try and write out to the console what the values are on load.
Turns out it's the responsive code. It works with my manual code OR with colVis extension IF there is no responsive code. So, debugging continues.
Yes - that is the issue. Currently ColVis and Responsive cannot operate on the same table together as they are both trying to use the same DataTables column visibility control.
This is something I indent to address in a future update.
Allan