我现在一直在敲打几个小时.我正在尝试动态填充选择xtype中的选项,但无法使其工作.这是我的dialog.xml
<resourceType
jcr:primaryType="cq:Panel"
title="Header Type">
<items jcr:primaryType="cq:WidgetCollection">
<headerType
jcr:primaryType="cq:Widget"
fieldLabel="Header Type"
name="./headerType"
type="select"
xtype="selection">
<options jcr:primaryType="cq:WidgetCollection">
<categories
jcr:primaryType="cq:Widget"
path="/content/admin/adminView/jcr:content/header-admin-content/cats/type.infinity.json"
width="500"
xtype="cqinclude" />
</options>
</headerType>
</items>
</resourceType>
Run Code Online (Sandbox Code Playgroud)
我正在制作的json:
content/admin/adminView/jcr:content/header-admin-content/cats/type.infinity.json
Run Code Online (Sandbox Code Playgroud)
看起来像这样:
{"jcr:primaryType":"nt:unstructured","item_1":
{"jcr:primaryType":"nt:unstructured","text":"small","parameter":"small"},"item_2":
{"jcr:primaryType":"nt:unstructured","text":"medium","parameter":"medium"},"item_3":
{"jcr:primaryType":"nt:unstructured","text":"large","parameter":"large"},"item_4":
{"jcr:primaryType":"nt:unstructured","text":"none","parameter":"none"}}
Run Code Online (Sandbox Code Playgroud)
当我打开对话框时没有任何反应我只是得到一个JS错误TypeError:snippet.xtype是未定义的
任何帮助表示赞赏!
selection可以通过两种方式动态设置xtype的选项
在这两种情况下,JSON返回的数据必须是一个数组.
要使用方法1,请在headerType节点上将 set options属性设置为将提供JSON数据的路径.将optionsRootproprety 设置为包含JSON数组的属性的名称.设置optionsTextField为应为文本的JSON数据中的属性名称.设置optionsValueField为JSOn数据中应该是值的属性的名称.
有关这方面的详细教程可以在这里找到:http://jenikya.com/blog/2013/04/dynamic-dialog-data-in-cq5.html
对于方法2,请参阅此
| 归档时间: |
|
| 查看次数: |
7333 次 |
| 最近记录: |