我正在尝试根据下拉列表中的值更改来加载选项卡。我收到错误box.findParentByType(...)。manageTabs不是一个函数。这是代码:
<?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:Dialog"
height="{Long}600"
manageTabs="function(tab,noSwitch){var tabs=['tab1','tab2','tab3'];var index=tabs.indexOf(tab);if(index==-1) return;for(var i=5;i&lt;tabs.length;i++){if(index==i){this.unhideTabStripItem(i);}else{this.hideTabStripItem(i);}}this.doLayout();if(!noSwitch)this.activate(index);}"
title="Campaign Tiles Configurations"
width="{Long}1000"
xtype="dialog">
<items
jcr:primaryType="cq:Widget"
xtype="tabpanel">
<items jcr:primaryType="cq:WidgetCollection">
<tab1
jcr:primaryType="cq:Panel"
title="Campaign Tiles">
<items jcr:primaryType="cq:WidgetCollection">
<campaigns
jcr:primaryType="cq:Widget"
fieldDescription="Press + to add more"
fieldLabel="Configure Tiles"
name="./campaigns"
width="1000"
xtype="multifield">
<fieldConfig
jcr:primaryType="cq:Widget"
name="./fieldConfig"
xtype="multifieldpanel">
<items jcr:primaryType="cq:WidgetCollection">
<headline
jcr:primaryType="cq:Widget"
fieldDescription="Provide headline for the individual tile"
fieldLabel="Headline"
key="headline"
width="{Long}560"
xtype="textfield"/>
<iconImage
jcr:primaryType="cq:Widget"
fieldDescription="Drag and drop or select the image in this field"
fieldLabel="Icon Image"
key="iconImage"
rootPath="/content/dam"
width="{Long}560"
xtype="ddpathfield"/>
<description
jcr:primaryType="cq:Widget"
fieldDescription="Provide description for the individual tile"
fieldLabel="Description"
key="description"
width="{Long}560"
xtype="textfield"/>
<subdescription
jcr:primaryType="cq:Widget"
fieldDescription="Provide sub-description for the individual tile. Use the mapping {{name}} above."
fieldLabel="Sub-description"
key="subdescription"
width="{Long}560"
xtype="textfield"/>
<buttonText
jcr:primaryType="cq:Widget"
fieldDescription="Text to be applied on the button"
fieldLabel="Button Text"
key="buttonText"
width="{Long}560"
xtype="textfield"/>
<url
jcr:primaryType="cq:Widget"
fieldDescription="URL on which the page navigates after the button is clicked"
fieldLabel="URL"
key="url"
rootPath="/content/XXXXX"
width="{Long}560"
xtype="pathfield"/>
<external
jcr:primaryType="cq:Widget"
fieldLabel="Open in a separate tab ?"
key="external"
labelStyle="width:155px"
xtype="checkbox"/>
<visible
jcr:primaryType="cq:Widget"
fieldLabel="Make VISIBLE?"
key="visible"
labelStyle="width:155px"
xtype="checkbox"/>
<selectList
jcr:primaryType="cq:Widget"
allowBlank="{Boolean}false"
fieldDescription="These are the items on which the rules selected above will be applied"
fieldLabel="Provide Options"
key="selectList"
type="select"
xtype="selection">
<listeners
jcr:primaryType="nt:unstructured"
loadcontent="function(){this.findParentByType('tabpanel').manageTabs(this.getValue(),true);}"
selectionchanged="function(box,value){box.findParentByType('tabpanel').manageTabs(value);}"/>
<options jcr:primaryType="cq:WidgetCollection">
<claims
jcr:primaryType="nt:unstructured"
key="claims"
text="Claims"
value="claims"/>
<plansandbenefits
jcr:primaryType="nt:unstructured"
key="plansandbenefits"
text="Plans & Benefits"
value="plansandbenefits"/>
</options>
</selectList>
</items>
</fieldConfig>
</campaigns>
</items>
</tab1>
<tab2
jcr:primaryType="cq:Widget"
anchor="100%"
title="Campaign Placeholders"
xtype="panel">
<listeners
jcr:primaryType="nt:unstructured"
render="function() { this.findParentByType('tabpanel').hideTabStripItem(1); }"/>
<items jcr:primaryType="cq:WidgetCollection">
<campaign_placeholders
jcr:primaryType="cq:Widget"
defaultValue="[{name},{DoB}]"
disabled="{Boolean}true"
emptyText="[{name},{DoB}]"
fieldDescription="These placeholders should be used while creating content. These are responsible for binding data from the back end."
fieldLabel="Placeholders"
name="/placeholders"
xtype="textarea"/>
</items>
</tab2>
<tab3
jcr:primaryType="cq:Widget"
anchor="100%"
title="Plans & Benefits Placeholders"
xtype="panel">
<listeners
jcr:primaryType="nt:unstructured"
render="function() { this.findParentByType('tabpanel').hideTabStripItem(2); }"/>
<items jcr:primaryType="cq:WidgetCollection">
<plansbenefits_placeholders
jcr:primaryType="cq:Widget"
defaultValue="[{name},{DoB}]"
disabled="{Boolean}true"
emptyText="[{name},{DoB}]"
fieldDescription="These placeholders should be used while creating content. These are responsible for binding data from the back end."
fieldLabel="Placeholders"
name="/placeholders"
xtype="textarea"/>
</items>
</tab3>
</items>
</items>
</jcr:root>
这里的不同之处在于选项下拉列表存在于多字段中。
提前致谢
===============================
这是一个更新。我已经能够通过对结构进行一些更改来解决问题。但现在问题是我无法改变对话框的高度和宽度。这是更新的代码:
<?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:Dialog"
boxMinHeight="{Long}600"
boxMinWidth="{Long}1000"
height="{Long}600"
manageTabs="function(tab,noSwitch){var tabs=['campaign','claims','benefits'];var index=tabs.indexOf(tab);if(index==-1) return;for(var i=1;i<tabs.length;i++){if(index==i){this.unhideTabStripItem(i);}else{this.hideTabStripItem(i);}}this.doLayout();if(!noSwitch)this.activate(index);}"
title="Campaigns"
width="{Long}1000"
xtype="tabpanel">
<items jcr:primaryType="cq:WidgetCollection">
<campaign
jcr:primaryType="cq:Widget"
height="{Long}600"
title="Campaigns"
width="{Long}1000"
xtype="panel">
<items jcr:primaryType="cq:WidgetCollection">
<campaigns
jcr:primaryType="cq:Widget"
fieldDescription="Press + to add more"
fieldLabel="Configure Tiles"
name="./campaigns"
width="1000"
xtype="multifield">
<fieldConfig
jcr:primaryType="cq:Widget"
name="./fieldConfig"
xtype="multifieldpanel">
<items jcr:primaryType="cq:WidgetCollection">
<headline
jcr:primaryType="cq:Widget"
fieldDescription="Provide headline for the individual tile"
fieldLabel="Headline"
key="headline"
width="{Long}560"
xtype="textfield"/>
<iconImage
jcr:primaryType="cq:Widget"
fieldDescription="Drag and drop or select the image in this field"
fieldLabel="Icon Image"
key="iconImage"
rootPath="/content/dam"
width="{Long}560"
xtype="ddpathfield"/>
<description
jcr:primaryType="cq:Widget"
fieldDescription="Provide description for the individual tile"
fieldLabel="Description"
key="description"
width="{Long}560"
xtype="textfield"/>
<subdescription
jcr:primaryType="cq:Widget"
fieldDescription="Provide sub-description for the individual tile. Use the mapping {{name}} above."
fieldLabel="Sub-description"
key="subdescription"
width="{Long}560"
xtype="textfield"/>
<buttonText
jcr:primaryType="cq:Widget"
fieldDescription="Text to be applied on the button"
fieldLabel="Button Text"
key="buttonText"
width="{Long}560"
xtype="textfield"/>
<url
jcr:primaryType="cq:Widget"
fieldDescription="URL on which the page navigates after the button is clicked"
fieldLabel="URL"
key="url"
rootPath="/content/XXXXX"
width="{Long}560"
xtype="pathfield"/>
<external
jcr:primaryType="cq:Widget"
fieldLabel="Open in a separate tab ?"
key="external"
labelStyle="width:155px"
xtype="checkbox"/>
<visible
jcr:primaryType="cq:Widget"
fieldLabel="Make VISIBLE?"
key="visible"
labelStyle="width:155px"
xtype="checkbox"/>
<selectList
jcr:primaryType="cq:Widget"
allowBlank="{Boolean}false"
fieldDescription="These are the items on which the rules selected above will be applied"
fieldLabel="Provide Options"
key="selectList"
type="select"
xtype="selection">
<listeners
jcr:primaryType="nt:unstructured"
loadcontent="function(){this.findParentByType('tabpanel').manageTabs(this.getValue(),true);}"
selectionchanged="function(box,value){box.findParentByType('tabpanel').manageTabs(value);}"/>
<options jcr:primaryType="cq:WidgetCollection">
<claims
jcr:primaryType="nt:unstructured"
text="Claims"
value="claims"/>
<benefits
jcr:primaryType="nt:unstructured"
text="Benefits"
value="benefits"/>
</options>
</selectList>
</items>
</fieldConfig>
</campaigns>
</items>
</campaign>
<claims
jcr:primaryType="cq:Widget"
height="{Long}600"
title="Claims"
width="{Long}1000"
xtype="panel">
<listeners
jcr:primaryType="nt:unstructured"
render="function() { this.findParentByType('tabpanel').hideTabStripItem(1); }"/>
<items jcr:primaryType="cq:WidgetCollection">
<parentPage
jcr:primaryType="cq:Widget"
fieldDescription="Leave empty to use current page"
fieldLabel="Parent page"
name="./parentPage"
xtype="pathfield"/>
</items>
</claims>
<benefits
jcr:primaryType="cq:Widget"
height="{Long}600"
title="Benefits"
width="{Long}1000"
xtype="panel">
<listeners
jcr:primaryType="nt:unstructured"
render="function() { this.findParentByType('tabpanel').hideTabStripItem(2); }"/>
<items jcr:primaryType="cq:WidgetCollection">
<ancestorPage
jcr:primaryType="cq:Widget"
fieldDescription="Leave empty to use current page"
fieldLabel="Parent page"
name="./ancestorPage"
xtype="pathfield"/>
</items>
</benefits>
</items>
</jcr:root>
提前致谢
答案 0 :(得分:0)
将xtype="tabpanel"
更改为xtype="dialog"