1
我試圖與sessionScope(不工作):把tabPanel轉發:最好的方法?
以下選項卡應該是可控的具有可變「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是按鈕「計算」,這執行一個代理程序,然後將可用'm1'設置爲'sol'。 我期望,Tab切換到「解決方案」,但沒有任何反應(儘管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>
另一種方法是使用組件(沒有工作,因爲「表演是不允許的TabPanel」):
<xp:this.action>
<![CDATA[#{javascript:
var c = getComponent("IdofTab");
c.show("IdofTab");
}]]>
</xp:this.action>
的c.setSelectedTab方法效果。謝謝Brian! –
很酷。 FYI stackoverflow禮節是「接受」一個答案:http://meta.stackexchange.com/a/5235,http://stackoverflow.com/help/accepted-answer –