Aem 在对话框'中访问CQ小部件;s加载内容

Aem 在对话框'中访问CQ小部件;s加载内容,aem,Aem,我在dialog的loadContent上有一个侦听器,我想从中访问特定的小部件。代码如下: loadContent : function(dialog) { var pan1 = dialog.findById("layout1"); pan1.hide(); console.log("pan1 ::: "+pan1); //gives null } 以下是对话框中的项目: <items jcr:primaryType="cq:Widget"

我在dialog的loadContent上有一个侦听器,我想从中访问特定的小部件。代码如下:

loadContent : function(dialog)
{
    var pan1 = dialog.findById("layout1");
    pan1.hide();
    console.log("pan1 ::: "+pan1); //gives null
}
以下是对话框中的项目:

<items
        jcr:primaryType="cq:Widget"
        xtype="tabpanel">
        <items jcr:primaryType="cq:WidgetCollection">
            <panel1
                jcr:primaryType="cq:Panel"
                title="Slide">
                <items jcr:primaryType="cq:WidgetCollection">
                    <one
                        jcr:primaryType="cq:Widget"
                        fieldLabel="one"
                        itemId="layout2"
                        name="./one"
                        type="checkboxgroup"
                        xtype="selection">
                        <options jcr:primaryType="cq:WidgetCollection">

                        </options>
                    </one>
                    <two
                        jcr:primaryType="cq:Widget"
                        fieldLabel="two"
                        itemId="layout1"
                        name="./two"
                        type="checkboxgroup"
                        xtype="selection">
                        <options jcr:primaryType="cq:WidgetCollection">  
                        </options>                      
                    </two>
                </items>
            </panel1>
        </items>


我想在特定条件下用选项隐藏特定选择。所以首先需要访问checkboxgroup。有什么想法吗?

不熟悉
findById
方法-您确定它正在查找“itemId”属性吗

您也可以使用
getField(…)
方法:

var pan1=dialog.getField(“./two”);
/*上面不清楚为什么名为“2”的字段的ID为“1”?打字错误*/

您可能还需要为
selectionchanged
添加一个侦听器,以便在加载后更改下拉列表值时显示部分

请尝试使用
id
代替
itemId


我曾尝试过类似的问题,它与id一起工作。

与widgets API一样:-

findById(字符串id):CQ.Ext.Component 不推荐使用:非常无用的方法,因为您可以只使用CQ.Ext.getCmp。应在4.0版本中删除 按id查找此容器下任意级别的组件

你可以用
查找('somePropertyLeeId','ValueOfAtPropertyLeyLayout2')[0]

你能举例说明吗?