I want to keep the column state in an array with stateSaveCallback in jQuery datatable. By default, I have 13 columns and I only have 9 of them hide/show in my colvis button. My problem is that the array I keep is 13 true in the first place, after starting to hide, the length of the array decreases by 1 every time I hide it. however, the length of the array I want should remain constant 13, if the index is hidden, it should turn into false in that array, I’ve been trying for a long time, please help
I just tried colvis to rotate between the columns I added to the button, but it still showed the same behavior.
2
Answers
this is my stateSaveCallback function
SOLVED
stateSaveCallback: function (settings, data) {
var columns = element.columns().visible();