select2-selection size problem

65 views
Skip to first unread message

Julien F.

unread,
Dec 28, 2015, 5:15:12 PM12/28/15
to select2
Hello all,

I'm using a bootstrap pane with a select2 inside. At the start, the pane is hide (not active), when I active it, the select2 span didn't take 100% width.
I try to set the pane to active, it's works (the select2 span take 100% width). But when it's in a inactive pane at the start, it doesn't work.

Anyone has a tip or a way to counter this strange running?

Thanks for your help.
Julien

Kevin Brown

unread,
Dec 28, 2015, 7:36:20 PM12/28/15
to select2

Select2 cannot accurately determine the width if it is not visible, so that's why it has problems when it is initialized and the tab is not active. A lot of people get around this issue by initializing Select2 when the tab is focused.

You should also be able to set an inline style for the width and Select2 will use that instead of trying to guess the width.


--
You received this message because you are subscribed to the Google Groups "select2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to select2+u...@googlegroups.com.
To post to this group, send email to sel...@googlegroups.com.
Visit this group at https://groups.google.com/group/select2.
For more options, visit https://groups.google.com/d/optout.

jfieu...@gmail.com

unread,
Dec 29, 2015, 5:11:21 AM12/29/15
to select2, ke...@kevin-brown.com
Thanks for your quick answer. It works fine.

Happy new eve and happy new year to you.
Julien
Reply all
Reply to author
Forward
0 new messages