Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

AUI SELECT 2 multi / populate via code (on premise)

aschuma November 9, 2020

In JIRA 8.13 I'am trying to code an autocompletion filed (multi values) based on the AUI select2 field.

field.auiSelect2(
{
multiple: true,
closeOnSelect: true,
tokenSeparators: [","],
placeholder: PLACEHOLDER,
minimumInputLength: 2,
formatResult: format,
initSelection: function (element, callback) {
callback({id: $(element).val(), text: $(element).val()});
},
ajax: {
url: <...>,
dataType: 'json',
data: function (term) {
return {term: term,};
},
results: function (results) {
return results;
},
quietMillis: 250,
cache: false
},
}
);

But I have also to populate the field programatically, In JIRA 8.2.x I did that by populating the field with a comma separated list of values. And this worked fine so fare. For JIRA 8.13 this did not work anymore. So I am passing the values like this by now:

field.val(["A",B","C"]).trigger('change');

 

But this results in a single entry in the input field value "A,B,C" wrapped wrapped with a single gray box instead of dedicated boxes for each passed value.

Any ideas how to solve that issue? I guess it might be related to the initSelection parameter.


1 answer

1 accepted

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS
AUG Leaders

Atlassian Community Events