2012-09-26 2 views
1

중첩 탭 패널을 만들었지 만 중첩 탭을 전환하는 방법을 찾을 수 없습니다. 누구든지 나를 도울 수 있을까? 고마워. 나는 활성화()를 시도ExtJS 중첩 탭 패널

var clubs = new Ext.TabPanel({ 
    renderTo:'clubs', 
    activeTab:0, 
    autoHeight:true, 
    defaults:{ 
     autoHeight:true, 
     cls:'tab-panel-item' 
    }, 
    items:[{ 
     title:'Shanghai', 
     cls:'nested-tab', 
     id:'shanghai-tab', 
     items:{ 
     xtype:'tabpanel', 
     defaults:{ cls:'tab-panel-item', autoHeight:true }, 
     containerCls:'nested-tab', 
     activeTab:0, // required 
     items:[{ 
        contentEl:'badminton', 
        title:'Badminton' 
       },{ 
        contentEl:'basketball', 
        title:'Basketball' 
       }] 
     } 
    },{ 
     title:'Hangzhou', 
     cls:'nested-tab', 
     items:{ 
     xtype:'tabpanel', 
     defaults:{ cls:'tab-panel-item', autoHeight:true }, 
     containerCls:'nested-tab', 
     activeTab:0, // required 
     items:[{ 
        contentEl:'hz-parent-child', 
        title:'Parent-child' 
       },{ 
        contentEl:'hz-football', 
        title:'Football' 
       }] 
     } 
    }] 
}); 

하지만, 그것은 단지 부모 탭을 전환 할 수 있습니다

다음은 내 JS 코드입니다.

답변

1

ExtJS 3.x를 사용하고 계신지요? 그리고 어디에서 탭을 변경하지 않으시겠습니까?

Ext.getCmp ('Your-Tab-Panel-Id');를 사용할 수 있습니다.

var clubs = new Ext.TabPanel({ 
    renderTo:'clubs', 
    activeTab:0, 
    autoHeight:true, 
    defaults:{ 
     autoHeight:true, 
     cls:'tab-panel-item' 
    }, 
    items:[{ 
     title:'Shanghai', 
     cls:'nested-tab', 
     id:'shanghai-tab', 
     items:{ 
     xtype:'tabpanel', 
     id:'shanghai-tab-nested-first', 
     defaults:{ cls:'tab-panel-item', autoHeight:true }, 
     containerCls:'nested-tab', 
     activeTab:0, // required 
     items:[{ 
        contentEl:'badminton', 
        title:'Badminton' 
       },{ 
        contentEl:'basketball', 
        title:'Basketball' 
       }] 
     } 
    },{ 
     title:'Hangzhou', 
     cls:'nested-tab', 
     items:{ 
     xtype:'tabpanel', 
     id:'shanghai-tab-nested-second', 
     defaults:{ cls:'tab-panel-item', autoHeight:true }, 
     containerCls:'nested-tab', 
     activeTab:0, // required 
     items:[{ 
        contentEl:'hz-parent-child', 
        title:'Parent-child' 
       },{ 
        contentEl:'hz-football', 
        title:'Football' 
       }] 
     } 
    }] 
}); 

Ext.getCmp('shanghai-tab-nested-second').Activate(1); 
Ext.getCmp('shanghai-tab-nested-first').Activate(1); 
+0

감사합니다. sra, Extjs 3.2를 사용하고 있습니다. 버튼을 클릭 할 때 태그를 변경하고 싶습니다. Ext.getCmp()를 시도했지만 tabPanel 대신 패널이 있습니다. – CunruiLi

+0

@CunruiLi 음, 코드에서 유일한 ID는 TabPanel이 아니라 Panel을 나타냅니다. 따라서이 예제를 TabPanels에 속해 있고 wraping 패널에 속하지 않도록 변경했습니다. – sra

+0

고마워요. 그것은 작동합니다. – CunruiLi