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

Error when using multi-select boxes #12

Open
creativitRy opened this issue Jul 6, 2018 · 4 comments
Open

Error when using multi-select boxes #12

creativitRy opened this issue Jul 6, 2018 · 4 comments

Comments

@creativitRy
Copy link

creativitRy commented Jul 6, 2018

Hello, thank you for this package!

When using a multi-select box/pillbox, the dropdown does not render properly when opening upwards. I looked through the code and realized that the line $("#select2-" + id + "-container") fails for a multi box because the down arrow does not exist.

I fixed this problem by changing the line to $("#" + id).parent().find(".select2").offset().top;, but this doesn't work when more than 1 select boxes exist in the parent.

@JacobEvelyn
Copy link
Member

Thanks for the tip, @creativitRy! (And sorry for the slow response!)

Using the test.html file in this repository that we typically use for testing the behavior of this package, I see the problem you're describing but I'm not sure the solution you mentioned is working for me. Am I correct that the line you're changing is the widgetBoxOffset = ...?

@creativitRy
Copy link
Author

Yes, that's the line I changed.

The solution I mentioned worked for my specific case where each select2 boxes were surrounded by a different div. I don't think this works for general cases.

@JacobEvelyn
Copy link
Member

Gotcha, thanks! I'll try playing with this a bit more and see what I can come up with.

@nbelley
Copy link

nbelley commented Dec 19, 2018

Also have this problem on my side, not sure if it's a bug on your part... it would be easier to fix if select2 did the same thing with its container (adding id) when in multiple than in single...

I changed the code in select2 js to do that and it works fine.

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