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

Add onChange property causes select box to be disabled, i.e. cannot click to show list. #85

Open
mnewlin opened this issue Jun 6, 2018 · 4 comments

Comments

@mnewlin
Copy link

mnewlin commented Jun 6, 2018

My Multiselect seems to work fine until I would like to add handler then it stops working.

This works:
<Multiselect data={groupList} multiple />

This does not work:
<Multiselect onChange={this.handleChange} data={groupList} multiple />

Any ideas??

@mnewlin
Copy link
Author

mnewlin commented Jun 6, 2018

I had a reference to bootstrap 4, once I changed all references to bootstrap 3, it started working. Strange that it only had an issue when I added the event handler.

@skratchdot
Copy link
Owner

That is odd. I'm not 100% sure what's going on. Was there an error being thrown in the console? If so, was it in the handleChange function, or in the react-bootstrap-multiselect code somewhere?

@mnewlin
Copy link
Author

mnewlin commented Jun 7, 2018

No console error. As long as I left off onChange property from the element it displayed fine. I tried to inspect the styles to see what was happening but couldn't find anything in the time that I spent looking. Once I downgraded to bootstrap 3.3.7 it started working again.

@JSiscar
Copy link

JSiscar commented Oct 9, 2020

It creates 2 ul elements when is added (an empty one and the one you actually created):

<ul class="multiselect-container dropdown-menu show" x-placement="bottom-start" style="position: absolute; transform: translate3d(0px, 38px, 0px); top: 0px; left: 0px; will-change: transform;"></ul>

<ul class="multiselect-container dropdown-menu"><li><a tabindex="0"><label class="checkbox"><input type="checkbox" value="Motogp"> Motogp</label></a></li><li><a tabindex="0"><label class="checkbox"><input type="checkbox" value="F1"> F1</label></a></li><li><a tabindex="0"><label class="checkbox"><input type="checkbox" value="Football"> Football</label></a></li><li><a tabindex="0"><label class="checkbox"><input type="checkbox" value="Surf"> Surf</label></a></li><li><a tabindex="0"><label class="checkbox"><input type="checkbox" value="Hockey"> Hockey</label></a></li><li><a tabindex="0"><label class="checkbox"><input type="checkbox" value="Rugby"> Rugby</label></a></li><li><a tabindex="0"><label class="checkbox"><input type="checkbox" value="Covid-19"> Covid-19</label></a></li><li><a tabindex="0"><label class="checkbox"><input type="checkbox" value="National"> National</label></a></li><li><a tabindex="0"><label class="checkbox"><input type="checkbox" value="Politics"> Politics</label></a></li><li><a tabindex="0"><label class="checkbox"><input type="checkbox" value="Fashion"> Fashion</label></a></li></ul>

This doesn't happen when the onChange event is removed. This is the code I have for the multiselect
<Multiselect className="col-md-12" data={multiselectData} id="formSignupMultiselect" onChange={() => this.handleSelect()} multiple />

Does anybody know why this is happening? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants