将 tabPanel 向前推进:最好的方法?
put tabPanel forward: best method?
我用 sessionScope 试过了(没用):
以下选项卡应该可以在变量 'm1' 的帮助下进行控制:
<xp:tabbedPanel id="tabbedPanel1"
selectedTab="#{javascript:sessionScope.get('m1')}">
<xp:tabPanel label="Config" id="conf">
<xc:k_conf></xc:k_conf>
</xp:tabPanel>
<xp:tabPanel label="Solution" id="sol">
<xc:k_sol></xc:k_sol>
</xp:tabPanel>
</xp:tabbedPanel>
控件 k_conf 中有一个按钮 'calculate',它执行一个代理,然后将变量 'm1' 设置为 'sol'。
我希望 Tab 切换到 'Solution',但什么也没有发生(尽管 refreshmode="complete")。
<xp:button value="calculate" id="button1">
<xp:eventHandler event="onclick" submit="true" refreshMode="complete">
...
<xp:executeScript>
<xp:this.script><![CDATA[#{javascript:
...
agent.runWithDocumentContext(docVG.getDocument());
sessionScope.put("m1","sol");
}]]>
</xp:this.script>
</xp:executeScript>
...
</xp:button>
另一种方法是使用组件(没有用,因为 'show is not allowed for TabPanel'):
<xp:this.action>
<![CDATA[#{javascript:
var c = getComponent("IdofTab");
c.show("IdofTab");
}]]>
</xp:this.action>
sessionScope 方法应该有效,我刚刚尝试并验证了这一点。按钮 eventHandler 是否有某些 CSJS 部分未返回 true 从而阻止执行 SSJS executeScript?
对于第二种方法,您可以使用选项卡面板的setSelectedTab
方法而不是show
,例如:
<xp:button id="button2" value="Change Tab 4">
<xp:eventHandler event="onclick" submit="true" refreshMode="complete">
<xp:this.action>
<![CDATA[#{javascript:
var c = getComponent("tabbedPanel1");
c.setSelectedTab("tabPanel4");
}]]>
</xp:this.action>
</xp:eventHandler>
</xp:button>
我用 sessionScope 试过了(没用):
以下选项卡应该可以在变量 'm1' 的帮助下进行控制:
<xp:tabbedPanel id="tabbedPanel1"
selectedTab="#{javascript:sessionScope.get('m1')}">
<xp:tabPanel label="Config" id="conf">
<xc:k_conf></xc:k_conf>
</xp:tabPanel>
<xp:tabPanel label="Solution" id="sol">
<xc:k_sol></xc:k_sol>
</xp:tabPanel>
</xp:tabbedPanel>
控件 k_conf 中有一个按钮 'calculate',它执行一个代理,然后将变量 'm1' 设置为 'sol'。 我希望 Tab 切换到 'Solution',但什么也没有发生(尽管 refreshmode="complete")。
<xp:button value="calculate" id="button1">
<xp:eventHandler event="onclick" submit="true" refreshMode="complete">
...
<xp:executeScript>
<xp:this.script><![CDATA[#{javascript:
...
agent.runWithDocumentContext(docVG.getDocument());
sessionScope.put("m1","sol");
}]]>
</xp:this.script>
</xp:executeScript>
...
</xp:button>
另一种方法是使用组件(没有用,因为 'show is not allowed for TabPanel'):
<xp:this.action>
<![CDATA[#{javascript:
var c = getComponent("IdofTab");
c.show("IdofTab");
}]]>
</xp:this.action>
sessionScope 方法应该有效,我刚刚尝试并验证了这一点。按钮 eventHandler 是否有某些 CSJS 部分未返回 true 从而阻止执行 SSJS executeScript?
对于第二种方法,您可以使用选项卡面板的setSelectedTab
方法而不是show
,例如:
<xp:button id="button2" value="Change Tab 4">
<xp:eventHandler event="onclick" submit="true" refreshMode="complete">
<xp:this.action>
<![CDATA[#{javascript:
var c = getComponent("tabbedPanel1");
c.setSelectedTab("tabPanel4");
}]]>
</xp:this.action>
</xp:eventHandler>
</xp:button>