hide column by default with colvis?
hide column by default with colvis?
fedein
Posts: 22Questions: 7Answers: 1
Hi!!
I need to hide a column by default using colvis. How can i do?
Thank you!
Regards!!
This discussion has been closed.
Answers
This example should help:
https://datatables.net/extensions/buttons/examples/column_visibility/columns.html
Kevin
Hi kthorngren , thank you very much for your answer.
in that case, for example, if i want to hide the column "name" by default. How can i do that?
Thanks and regards!!
columnDefs
can be used to hide the column. Use{ targets: 0, visible: false}
to hide the first column.@allan I don't think your example to remove
name
from the visibility list is working.Kevin
Thank you!!
But i want set the column "name" hide by default. Then i need to click the colvis button and show the column "name". Is this possible???
Sorry for my bad English...
Regards!!
I think the best you can do is use a class name. Take a look at
columnDefs.targets
to see all the options for selecting the column.Kevin
@kthorngren - Completely agree. That's a bug in the current release I'm afraid. The site uses the current release version which is why it is still present there.
The next Buttons release will fix it. Thanks!
Also I agree - use
columns.visible
to hide a column by default.Allan