Forums

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

Populate data into Multiselect2 Custom Field

JonasGomes April 23, 2018

Hi team,

i'm confusing about this feature. In documentation about Select2 we have this code: 

var $exampleMulti = $(".js-example-programmatic-multi").select2();

and

$exampleMulti.val(["CA", "AL"]).trigger("change");

In Atlassian (AuiSelect2) this doenst work. Your have any example how i do this via javascript? The Atlassian AUI Documentation dont have examples for that feature...

Thanks.

 links:

Multiselect2 and Select2: https://select2.org/programmatic-control/methods
Atlassian AUI Select2: https://docs.atlassian.com/aui/7.8.0/docs/auiselect2.html

 

 

1 answer

1 accepted

0 votes
Answer accepted
JonasGomes April 23, 2018

I solved the problem this way

var data = ["value1","value2"];
var element = AJS.$('#multiselect2Id").auiSelect2();
element.val(data).trigger('change');

Suggest an answer

Log in or Sign up to answer