Hide columns default and colvis button extension
Hide columns default and colvis button extension
jigar311982
Posts: 70Questions: 31Answers: 0
Hello,
I have 13 columns in table, and i am using colvis buttons extension for showing\hiding column,
But when page load, at datatable initialization i want to show only 6 columns and rest will be hidden, user can choose it from button if he wish to see it.
I have used below to hide columns,
"columns": [
{ "data": "testx" },
{ "data": "test1", "visible": false },
{ "data": "test2", "orderable": false, "visible": false },
{ "data": "test3", "visible": false },
{ "data": "test4", "orderable": false, "visible": false },
{ "data": "test5", "visible": false },
{ "data": "test6", "visible": false },
]
But with this, columns always visible default, i can hide it with buttons, but want default hidden,
All datatable and extension versions are latest uptodate,
Any advice?
Thanks,
This discussion has been closed.
Answers
Ran into the same question. Adding "visible:false" worked for me. If I used quotes around false it didn't work (I assume string versus boolean issues). For example:
columns.visible
must be a boolean value, but it looks like it is in @jigar311982's code. If this is still an issue for you jigar311982, please link to a test case showing the issue.One possibility is that you have state saving enabled and it state saved the columns as visible.
Allan