How to pass initial Selection value for aui-select2 in Jira 8 (Select 2 version 3.x.x)

Hi there,

I’m trying to using the aui-select2 in my Jira plugin. The aui-select2 get the data by AJAX requesting to a REST API.

As we know in Jira 8, the version of select2 which packaged in AUI is version 3.x.x. Which means if we want to user select2 with AJAX datasource, the original element “my-selector” must be an input.
$("#my-selector").aui-select2( { …, ajax(…),…});
It works well if the target is just: Type something on the input, it loads the data.

The problem is I need to specify some initial selected element for the select2.

In select2 version 4 (which is currently NOT shipped with Jira), having “my-selector” as a html select, and some initial options does the trick.
Or original version of select2, setting the initialSelection makes it work also.

I did some researches in many pages, such as original select2 homepage, or Atlassian community

I tried to follow what people did with select2 but I cannot make it work the same way with aui-select2.

Any help would be appreciated!