Using tabs to toggle column visibility
Using tabs to toggle column visibility
aab159
Posts: 1Questions: 1Answers: 0
There's an example on the DataTables site that uses Bootstrap tabs to apply a filter.
https://datatables.net/examples/api/tabs_and_scrolling.html
I'm looking for a way that the tabs can toggle column visibility instead.
So tab 1 shows columns [1,2,3,4] and tab 2 shows columns [1,2,5,6].
Is there a way to do this?
This discussion has been closed.
Answers
Unless you are using essentially as a view, I not sure why you would not just use the column visibility button and let your users have full control.
But to answer your question, use the tab top part but only one content page.
Use the tab change event handler to turn on and off column visibility.
Here is something for you to play with along these lines
http://jsbin.com/mulifol/edit?css,js,output
Exactly as @bindrid says - use the Bootstrap tab events to call the
columns().visible()
method.Brilliant example @bindrid!
Allan