在AEM的“触摸UI”对话框中从外部服务动态加载选择选项? [英] Load select options dynamically from external service in Touch UI dialog in AEM?

查看:126
本文介绍了在AEM的“触摸UI”对话框中从外部服务动态加载选择选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是在带有动态选项的触摸UI对话框中加载选择字段。这些选项来自通过webservices的外部URL,我正在使用在我们的全局javascript对象之一中定义的url来使用RESTful服务,例如

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';

请理解选项来自第三方Web服务,请不要提及数据源。每当我动态搜索加载选择选项时,我都会获得本教程

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

链接到教程
这不是我想要的。

在传统UI中,使用optionsProvider很容易。

In classic UI it is easy with optionsProvider.

在触摸UI中,我试图编写一个

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?

推荐答案

您应该为组件创建JS侦听器。

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
});

请参阅文档:动态更新AEM TouchUI对话框选择字段

这篇关于在AEM的“触摸UI”对话框中从外部服务动态加载选择选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆