Extjs 如何根据当前页面在CQ对话框中配置根路径
我有以下Extjs 如何根据当前页面在CQ对话框中配置根路径,extjs,aem,Extjs,Aem,我有以下CQ dialog.xml: <?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" jcr:primaryType="cq:TabPanel" activeTab="{Lo
CQ dialog.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
xmlns:nt="http://www.jcp.org/jcr/nt/1.0" jcr:primaryType="cq:TabPanel"
activeTab="{Long}0" title="mContactConnect_dialogtitle" headerAsText="true"
xtype="tabpanel">
<items jcr:primaryType="cq:WidgetCollection">
<tab1 jcr:primaryType="cq:Widget" anchor="100%" title="myTitle"
xtype="panel">
<items jcr:primaryType="cq:WidgetCollection">
<subheadline jcr:primaryType="cq:Widget" fieldLabel="subheadline_label"
name="./subheadline" maxLength="80" xtype="textfield"/>
<text jcr:primaryType="cq:Widget" fieldLabel="text_label" name="./text"
maxLength="150" xtype="textfield"/>
<reference jcr:primaryType="cq:Widget" fieldLabel="reference_label"
name="./reference" forceSelection="true" xtype="pathfield" rootPath ="/content" />
</items>
</tab1>
</items>
</jcr:root>
我使用firebug跟踪函数调用。为此,我在init:function(widget){
行上设置了断点。当我向前一步时,步骤指针跳转到最后一行CQ.Ext.reg…
为什么init
函数不调用
CQ.Ext.ComponentMgr.registerPlugin('myExtendedRootPath', myExtendedRootPath);
参考
对话框字段:
<reference
jcr:primaryType="cq:Widget"
fieldLabel="reference_label"
name="./reference"
forceSelection="true"
xtype="pathfield"
rootPath ="/content"
plugins="myExtendedRootPath" />
(可选)查找一个工作示例。这适用于所有可能对动态设置pathfield组件的defaultValue感兴趣的人。这对我将值设置为当前页面路径起到了作用: (遵循上面提到的插件src代码)。然后,使用以下命令:
widget.setValue(cq.utils.WCM.getPagePath()).
有趣的是,我必须在dialog.xml中手动定义一个“defaultValue”字段,然后上面的行才能成功运行!奇怪..因此我的对话框如下所示:
<reference
jcr:primaryType="cq:Widget"
fieldLabel="reference_label"
name="./reference"
forceSelection="true"
xtype="pathfield"
defaultValue="/content/any/random/string"
plugins="myExtendedRootPath" />
不确定这有多大帮助,但您可以将id作为xml属性添加到路径字段,然后尝试使用CQ.Ext.getCmp(“添加到路径字段的id值”)。setRootPath(“此路径将是动态路径”);将此添加到从JSP加载的js文件中最初,您使用了dmyExtendedRootPath
,然后myExtendedRootPath
-这是打字错误吗?
widget.setValue(cq.utils.WCM.getPagePath()).
<reference
jcr:primaryType="cq:Widget"
fieldLabel="reference_label"
name="./reference"
forceSelection="true"
xtype="pathfield"
defaultValue="/content/any/random/string"
plugins="myExtendedRootPath" />