Column Toggle

Column Toggle

roberto_folettiroberto_foletti Posts: 1Questions: 0Answers: 0

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

  • kthorngrenkthorngren Posts: 21,172Questions: 26Answers: 4,923
    edited June 2020

    You provided a link to columnToggle but are using columnsToggle. Note the plural columns. If you want a single button for all of .class1 then use the singular version of columnToggle. If you want a button for each column use the plural version of columnsToggle.

    Kevin

This discussion has been closed.