2010-06-01 88 views
0

我使用的是帶有DOJO插件的struts2.1.6。如何在sx中選擇默認選項卡:tabbedPanel struts 2.1.6 dojo

我有三個選項卡顯示爲TabValue1,TabValue2和TabValue3。如果單擊某個URL,我想要將TabValue2顯示爲默認選項卡,否則TabValue1是默認選項卡。

下面是代碼:

<sx:tabbedpanel cssStyle="width: 630px; height: 600px;" doLayout="true" 
     id="tabbedPanel2" selectedTab="TabValue2"> 
     <s:if test="apptypes.size>0"> 

     <s:iterator value="apptypes" id="apptype" status="app_stat"> 
     <img id="indicator" src="/jctaylor/images/loader.gif" 
      style="display: none" /> 

     <sx:div label="%{name}" id="%{name}" indicator="indicator" 
      loadingText="Loading..." href="%{showTab}%{typeid}" 
      refreshOnShow="true" preload="false" > 

     </sx:div> 
     </s:iterator> 

     </s:if> 

     </sx:tabbedpanel> 

它的默認選項卡選擇這是第一個選項卡的工作。但是當我點擊應該選擇TabValue2選項卡的鏈接時,它不起作用。我爲它創建了一個單獨的頁面,並將selectedTab =「TabValue2」,但仍然顯示選定的TabValue1。

如果您有任何建議,請讓我知道。

回答

0

我已想出溶液

的解決方案是:而不是指定的標籤selectedTab =的值「TabValue2」指定相應的選項卡的標識。如圖所示:

<sx:tabbedpanel cssStyle="width: 630px; height: 600px;" doLayout="true" 
    id="tabbedPanel2" selectedTab="tab2"> 
    <s:if test="apptypes.size>0"> 

    <s:iterator value="apptypes" id="apptype" status="app_stat"> 
    <img id="indicator" src="/images/loader.gif" 
     style="display: none" /> 
    <s:set var="i" name="counter1" value="#app_stat.count"/> 
    <sx:div label="%{name}" id="tab%{counter1}" indicator="indicator" 
     loadingText="Loading..." href="%{showTab}%{typeid}" 
     refreshOnShow="true" preload="false" > 

    </sx:div> 
    </s:iterator> 

    </s:if> 

    </sx:tabbedpanel>