把tabPanel向前推:最好的方法?

Uwe*_*zke 1 tabpanel xpages

我用sessionScope尝试了这个(没用):

在变量'm1'的帮助下,以下Tabs应该是可控的:

<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>
Run Code Online (Sandbox Code Playgroud)

在控制中,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>
Run Code Online (Sandbox Code Playgroud)

另一种方法是使用组件(因为'TabPanel不允许显示'而无效):

 <xp:this.action>
   <![CDATA[#{javascript:
         var c = getComponent("IdofTab");
         c.show("IdofTab");
      }]]>
 </xp:this.action>
Run Code Online (Sandbox Code Playgroud)

Bri*_*IBM 5

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>
Run Code Online (Sandbox Code Playgroud)

  • 凉.FYI stackoverflow礼仪是"接受"答案:http://meta.stackexchange.com/a/5235,http://stackoverflow.com/help/accepted-answer (2认同)