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

`includeSelectAllOption={true}` does not trigger `onChange` #33

Open dragma opened 8 years ago

dragma commented 8 years ago

Hi, Is there any way to trigger the onChange event when the includeSelectAllOption is set to true and we click on "select all" ? Regards, F.

dragma commented 8 years ago

Foud the answer : there is a onSelectAll props that can do this.

BUT, I think I found a bug !

When enableCaseInsensitiveFiltering is true and onSelectAll is set, pressing a keyboard key inside the search input triggers the onSelectAll function. Am I misunderstanding something ?

skratchdot commented 8 years ago

I'm not entirely sure of the answer (as I haven't really looked at this lib in a while). It sounds like that's probably an unintended side-effect of the way this wrapper was written.

If the original library doesn't trigger onSelectAll when using the enableCaseInsensitiveFiltering feature, then it's probably caused by something in the componentWillReceiveProps code here:

https://github.com/skratchdot/react-bootstrap-multiselect/blob/b6bfa756d94e7a7d8a522d11e79b281059a25651/lib/index.js#L67-L79