Button collection styles when using toggle

Button collection styles when using toggle

silkspinsilkspin Posts: 152Questions: 34Answers: 5

I have successfully been using colvis with a button next to it which makes hidden columns visible again. This prevents users having to toggle each column on again. Everything worked fine and all the colvis buttons had their styles set to the default after clicking the button.

I now need to be able to toggle multiple columns with one button. I’ve managed to do this and the styles indicate the toggle state when the button collection is used. The “show all” button works fine too and makes the hidden columns visible again.

The problem I have is that I can’t reset the style on the buttons in the collection menu that were toggled off before clicking the “show all” button. They become out of sync. I have tried $('.dt-button-collection .dt-button').addClass('active’); but because the button collection is only in the DOM when it’s clicked on I can’t do this. My question is how can I get the class to be active again, or is there a way of toggling all off buttons to on again which would add the active class the next time the collection button is clicked?

http://live.datatables.net/sarepehu/1/edit

This question has an accepted answers - jump to answer

Answers

This discussion has been closed.