【发布时间】:2014-09-07 07:28:44
【问题描述】:
在我的一个对话框中,我有一个 xtype 为“pathfield”的字段。根据该字段的值,我想更改“选择框”的选项(xtype="selection",type="select")。
我使用了侦听器并为“pathfield”字段添加了事件“change”和“dialogclose”的函数。
我可以调用 servlet,它正在发送带有选项的 JSON 响应,但是,我无法使用这些选项填充选择框。
以下是dialog.xml的代码
<select-product jcr:primaryType="cq:Widget"
fieldDescription="Select Product (Product Details Page)"
fieldLabel="Select Product"
height="{Long}40" key="productPath"
name="./productPath"
style="height:21px"
width="{Long}350"
rootPath="/content/MY_MSM_PATH"
xtype="pathfield">
<listeners jcr:primaryType="nt:unstructured"
change="function(){ var selectBox=$('select[name=features]');
$.getJSON('/bin/featuresservlet?path=' + this.value,
function(jsonData){
$.each(jsonData, function(i,data){
$('<option>').val(data.value).text(data.name).appendTo('select[name=features]');
});
}); }"
dialogclose="function(){
var selectBox=$('select[name=features]');
$.getJSON('/bin/featuresservlet?path=' + this.value, function(jsonData){
$.each(jsonData, function(i,data){
$('<option>').val(data.value).text(data.name).appendTo('select[name=features]');
});
}); }" />
</select-product>
<features jcr:primaryType="cq:Widget"
fieldLabel="Select Features:"
key="features"
name="./features"
type="select"
xtype="selection" />
【问题讨论】:
标签: aem