Hi colleagues,
same issue as of this post of 2017; AUI Select 2 not working properly
Tried this code even but the result appears to be the same as the screenshot attached.
Console provides an error like: AJS.MultiSelect is not a constructor…
Presumably, there is something wrong of AUI settings on the server? Confuence v7.2.0, AJS.version 8.3.5.
I tried the code of select2 AUI web page (AUI Select2 - AUI Documentation) prior to this post, but provided same result.
@Named
public MyServlet extends HttpServlet {
@ConfluenceImport
private PageBuilderService pageBuilderService;
@Inject
public MyServlet(PageBuilderService pageBuilderService) {
this.pageBuilderService = pageBuilderService;
}
// call this either in your page action or your web fragment renderer.
// in either case, call it before your template is rendered.
private void requireMyResources() {
pageBuilderService.assembler().resources().requireWebResource("com.atlassian.auiplugin:aui-select2");
pageBuilderService.assembler().resources().requireWebResource("com.atlassian.auiplugin:aui-forms");
}
}
If you have your own JS and CSS to apply to your UI, instead of requiring the AUI resources directly from your Java code, you might instead create your own web-resource and require that instead:
Well, your question regarding loading… I forgot to mention. Via Adaptavist Scriptrunner for Confluence. Creating a scripted macro, which is going to load the J + JS code.
I would rather refer to the atlassian-plugin.xml, which honestly does not exist yet on server. This is most probably my issue.
Which way might be the better one, resources or xml file?
Quite new, as I’ve been working w/ Jira before.
Ah, I’m not familiar with ScriptRunner’s capabilities for defining and loading UI code. Perhaps @jmort or @dluksza could chime in and offer assistance on that front?
I’m one of the developers working on the ScriptRunner team.
In order to limit amount of data send to client and seed up page load times, the Custom Macros doesn’t include any of the additional AUI dependencies. Select2 is one of those dependencies that are not available by default.
As @daz already mentioned you need require select2 on your own. In case of ScriptRunner Script Macros you need to add:
thanks a lot.
It perfectly works out now. Really, like posted in the initially mentioned link of mine, of AUI v8.3.5.
The question, did I miss any web post or is it professional developer knowledge?
Thanks anyway to @daz and to you for really fast reply and resolution.
Very much appreciate.
Since I am continuing to work w/ Scriptrunner I may have to address further inquiries directly…