Populating select-box options on changing pathfield in dialog of Adobe cq5

不问归期 提交于 2019-12-04 15:42:11

you can use the set options method of the selection xtype. Modify your listener to something like this

dialogclose="function(pathfield){ 
        var dialog = pathfield.findParentByType('dialog');
        var selectBox = dialog.findByType('selection')[0]; //assuming this is the only selection you have
        $.getJSON('/bin/featuresservlet?path=' + this.value, function(jsonData){
            selectBox.setOptions(jsonData);
            selectBox.doLayout(flase,false);
        }); }" 

The data returned by your servlet must be of the following format :

[
 {
    "value": "valueOfOption1",
    "text": "textOfOption1"
 },
 {
    "value": "valueOfOption2",
    "text": "textOfOption2"
 }

]

Reference : http://dev.day.com/docs/en/cq/5-6/widgets-api/index.html?class=CQ.form.Selection

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