【发布时间】:2014-11-21 11:05:14
【问题描述】:
我的组件对话框中有一个选择框,有四个选项:
- 关闭
- 默认
- 插件
- 覆盖
在对话框中,我想根据 URL 路径是否包含特定字符,将defaultValue 属性动态设置为“关闭”或“默认”。这可能吗?
这是 dialog.xml sn-p 与我尝试执行此操作的侦听器:
<extra_meta_description_tag_mode
jcr:primaryType="cq:Widget"
defaultValue=""
fieldLabel="SEO Description Usage"
name="./extraMetaDescriptionTagMode"
type="select"
xtype="selection">
<listeners
jcr:primaryType="nt:unstructured"
defaultValue="function(url) {
url.contain("en_gb/news") ? return "default" : return "off";
}"/>
<options jcr:primaryType="cq:WidgetCollection">
<off
jcr:primaryType="nt:unstructured"
text="Off"
value="off"/>
<default
jcr:primaryType="nt:unstructured"
text="Append pre-set text"
value="default"/>
<addon
jcr:primaryType="nt:unstructured"
text="Append input text"
value="addon"/>
<over_write
jcr:primaryType="nt:unstructured"
text="Overwrite"
value="overwrite"/>
</options>
</extra_meta_description_tag_mode>
【问题讨论】:
-
URL路径是指当前页面的路径还是别的什么意思?
-
ye,当前页面的路径,例如 /content/sometestweb/en-gb/news/testnews.html
标签: extjs dialog content-management-system components aem