rows checkbox toggle

rows checkbox toggle

rohit99rohit99 Posts: 22Questions: 9Answers: 0

We need a custom button that would be reverse the checked and unchecked rows. If I click once, all checked rows will be unchecked and unchecked rows will be checked. vice versa.

like this:
var $checkbox = $(this).find(':checkbox');
$checkbox.attr('checked', !$checkbox.attr('checked'));

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @rohit99 ,

    Allan gave this example earlier today on a different thread. As you can see, the button but just flips on or off all checkboxes, but it would be trivial to iterate those table.rows().nodes() and flip the checkbox value.

    Hope that helps,

    Cheers,

    Colin

This discussion has been closed.