Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

AUI Select2 not taking parameters into account

Frédéric Tardieu
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 27, 2015

Hello,

I'm trying to pass some parameters to aui.select2() method, but it seems that no parameter is taken into account. For instance, the following code:

AJS.$("#select2-example").auiSelect2({
placeholder: "Select an option"
});

The JSFiddle is there:http://jsbin.com/wolaxuyare/1/edit

Any idea? Thanks a lot!

Fred

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Sean Curtis
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 27, 2015

Frédéric Tardieu I think there might be an issue in how we wrap Select2 within AJS. I'm guessing we don't pass options through correctly. Whether this is by design or accident, I'm not sure. I'll chase it up.

Frédéric Tardieu
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 3, 2015

I Sean, TTheB was right, adding an empty <option></option> solves the placeholder text option problem, as stated in Select2 documentation. Moreover, I'm now using other select2 options like formatResult and formatSelection, and it works fine, so I think there is no problem in the way AUI passes the options (according to select2 documentation).

2 votes
Tim
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 27, 2015

When placeholder is used for a non-multi-value select box, it requires that you include an empty <option></option> tag as your first option.

https://select2.github.io/select2/#placeholders

Frédéric Tardieu
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 27, 2015

Thanks a lot T the B ;-)

TAGS
AUG Leaders

Atlassian Community Events