Load select options dynamically from external service in Touch UI dialog in AEM?

喜你入骨 提交于 2019-12-25 03:15:39

问题


My problem is to load a select field in touch UI dialog with dynamic options. These options are coming from a external URL via webservices, I am consuming this RESTful services using url defined in one of our global javascript objects like

$.get(mec.serviceConfig.baseUrl + '/movies';

Please understand that the options are coming from third party webservice please do not mention datasource. Whenever I search for loading select options dynamically I get this tutorial

Link to Tutorial This is is not what I want.

In classic UI it is easy with optionsProvider.

In touch UI I am trying to write a script that fetches the data from the external webservice via AJAX ON DIALOG load and set these options in the select field.

Is there any better easier approach ? Can someone please share code snippets?


回答1:


you should create JS listener for your component.

$document.on("dialog-ready", function() {
// there you should find your select field 
//for example
var language = $("[name='./language']").closest(".coral-Select");
//then append to your select field new options from your datasource
});

please see doc: Dynamically updating AEM TouchUI Dialog Select Fields



来源:https://stackoverflow.com/questions/49788289/load-select-options-dynamically-from-external-service-in-touch-ui-dialog-in-aem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!