Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trigger 'change' event for all checkboxes in range mode. #15

Open
sgrifenhagen opened this issue May 21, 2015 · 2 comments
Open

Trigger 'change' event for all checkboxes in range mode. #15

sgrifenhagen opened this issue May 21, 2015 · 2 comments

Comments

@sgrifenhagen
Copy link

I moved this from inside another issue, as I misread what the original problem was.

here's my scenario.

table contains multiple columns, with a checkbox in the first. checkbox has an onchange event handler associated with each cb.

table is contained in a div with the data-toggle="checkboxes" data-range="true".

using bootstrap, jquery, jquery ui, tablesorter, and checkboxes.

i click on the first box. press the shift key and click on the bottom of the range.

the event handler for the first box fires. the handler for the bottom box of the range fires. all the intermediate boxes are changed, but the handler for them do not fire.

it is repeatable. in firefox, chrome, and IE.

I have tested it without the tablesorter and got rid of as much extra as i can. didn't make any difference

any suggestions?

@sgrifenhagen
Copy link
Author

make the following change from

      $checkboxes.slice(start, end)
        .filter(':not(:disabled)')
        .prop('checked', $checkbox.prop('checked'));

to this:

      $checkboxes.slice(start + 1, end - 1)
        .filter(':not(:disabled)')
        .prop('checked', $checkbox.prop('checked'))
        .trigger('change');              //

The first line changes (+1 and -1 to the range) became necessary because the change event occurred prior to the execution of the checkbox.range function, so the rows that were actually clicked on had the event fired. the rows in between did not. forcing the event to fire appears to have fixed that.

@sgrifenhagen
Copy link
Author

and one final note for now.

I'd like to thank you for this. it has made my life much easier, as I'm a) not the swiftest javascript coder and b) just now learning jquery (brute force method). Your plugin is a life saver.

thanks...

@rmariuzzo rmariuzzo changed the title range onchange event not firing for items between start and finish in range. Trigger 'change' event for all checkboxes in range mode. Oct 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants