skratchdot / react-bootstrap-multiselect

A multiselect component for react (with bootstrap). This is a react port of bootstrap-multiselect.
http://projects.skratchdot.com/react-bootstrap-multiselect/
Other
119 stars 61 forks source link

The onSelectAll event is firing even if the user manually selects all options #62

Open dustinaleksiuk opened 7 years ago

dustinaleksiuk commented 7 years ago

In the original control that I believe this one is based on, the documentation says that onSelectAll won't be fired if the user selects all options manually. Only if the user clicks the "All" checkbox.

http://davidstutz.github.io/bootstrap-multiselect/#configuration-options-onSelectAll

In this control, the event does fire. This makes it really hard to manage the select all event, because when I populate the control with selected values on load, it fires the event, making react rerender and repopulate the values (causing an infinite loop).

I might be doing something wrong, but it was noteworthy to me that the davidstutz version apparently behaves differently.

This control is awesome. Thanks for making it.

skratchdot commented 7 years ago

Thank you for the details! I haven't done anything w/ this repo in a while, so I'm hoping to find some time soon to clean up some of the code, write some tests, and look into bugs like this. The infinite loop sounds very bad, so I want to prevent anything like that from happening.

vped commented 7 years ago

@skratchdot it seems this issue yet not fixed. If you already working on this issue please let me know. I am thinking to work on this issue.

skratchdot commented 7 years ago

@vped - I have not worked on it, and will probably not have time to. Please feel free to work on a fix. Keep in mind, the fix needs to go in https://github.com/skratchdot/react-bootstrap-multiselect/blob/master/lib/index.js (not one of the /lib/bootstrap* which are auto-generated / pulled from the upstream library).