Problem with Multi Level Button Collection
Problem with Multi Level Button Collection
Test case: https://live.datatables.net/yeciyola/1/edit
In this test case, I have a a multi level button collection Button Group with 3 buttons Button 1, 2, 3 and a Deactivate Button 1. When Buttons 1,2,3 are inactive, they have the color red and when active green.
Deactivate Button 1 deactivates Button 1 in the group chaning its background color back to red. When clicking on Button 1 and then on Deactivate Button 1, Button 1 should change from red back to green. This works fine until you do this for the 3rd, 4th or 5th time as for some reason Button 1's background gets stuck at green and doesn't change back to red - meaning Deactivate Button 1 sometimes works and sometimes doesn't.
What could be the issue here?
This question has an accepted answers - jump to answer
Answers
When you trigger the button the button isn't visible so
$('.rr_button2').css('background', '');
won't find the button. Usebutton().node()
to get the node to set the CSS. I added a console log statement to show how many elements$('.rr_button2')
finds when the button is deactivated. Also updated it to usebutton().node()
instead.https://live.datatables.net/yeciyola/2/edit
Kevin
Appreciate this! Thank you!