Column Toggle
Column Toggle

Hi,
I'm trying to use the second example in the following link
https://datatables.net/reference/button/columnToggle
I use this code in order to create two buttons which toggle the visibility of all columns with the class1 and class2
dom: 'Bfrtip',
buttons: [
{
text: 'Giorni',
extend: 'columnsToggle',
columns: '.class1'
},
{
text: 'Settimane',
extend: 'columnsToggle',
columns: '.class2'
}
]
But the result is 1 button for each column class1 and class2 and not 2 button to toggle class1 items and class2 items.
So for example if there are 15 column with attribute class1, I have 15 buttons....
Thanks.
Roberto
Replies
You provided a link to
columnToggle
but are usingcolumnsToggle
. Note the pluralcolumns
. If you want a single button for all of.class1
then use the singular version ofcolumnToggle
. If you want a button for each column use the plural version ofcolumnsToggle
.Kevin