2012-06-25 2 views
0

tab.Panel보기에 링크하여 두 번째 또는 세 번째 (첫 번째가 아닌) tabItem을 선택할 수 있습니까?Tab.Panel보기 내에서 두 번째 tabItem에 연결

지금 현재로
Ext.define("app.view.MyView", { 
    extend: 'Ext.tab.Panel', 
    xtype: 'myview', 
    alias: 'widget.myview', 
    requires: [ 
     'Ext.TitleBar', 
     'dev.view.1', 
     'dev.view.2', 
     'dev.view.3', 
     'dev.view.4', 
     'dev.view.5', 
    ], 
    config: { 
     tabBarPosition: 'bottom', 
     title: 'My Title', 
     ui: 'neutral', 

     items: [ 
      { 
       xtype: 'xtype-of-view-1' 
      }, 
      { 
       xtype: 'xtype-of-view-2' 
      }, 
      { 
       xtype: 'xtype-of-view-3' 
      }, 
      { 
       xtype: 'xtype-of-view-4' 
      }, 
      { 
       xtype: 'xtype-of-view-5' 
      } 
     ] 
    } 
}); 

내가보기에로드 '위해 xtype -보기-1'로 설정됩니다

현재 나는이처럼 보이는 tab.Panel에 연결있어 전망을 활성 탭 그러나 탭보기에서로드 할 수 있지만 다른 탭 중 하나를 활성화하고 누른 상태로 둘 수 있습니까?

답변

1
Ext.define("app.view.MyView", { 
    extend: 'Ext.tab.Panel', 
    xtype: 'myview', 
    alias: 'widget.myview', 
    requires: [ 
     'Ext.TitleBar', 
     'dev.view.1', 
     'dev.view.2', 
     'dev.view.3', 
     'dev.view.4', 
     'dev.view.5', 
    ], 

    config: { 
     tabBarPosition: 'bottom', 
     title: 'My Title', 
     ui: 'neutral', 

     items: [ 
      { 
       xtype: 'xtype-of-view-1' 
      }, 
      { 
       xtype: 'xtype-of-view-2' 
      }, 
      { 
       xtype: 'xtype-of-view-3' 
      }, 
      { 
       xtype: 'xtype-of-view-4' 
      }, 
      { 
       xtype: 'xtype-of-view-5' 
      } 
     ] 
    }, 
    initialize: function() { 
     var items = this.getItems(), 
      itemIdx, 
      Ext.each(items, function(item, idx) { 
       if (item.xtype == 'xtype-of-view-2') { 
        itemIdx = idx; 
        return false; 
       } 
      }); 
      this.setActiveItem(itemIdx); 
    } 
}); 

당신은 또한 당신이 응용 프로그램 당신에게 컨트롤러를 추가 할 수있는 멋진 비디오 가이드에게 http://docs.sencha.com/touch/2-0/#!/video/tabs-toolbars

을 볼 수 있었다. 컨트롤러에서 참조 추가

sencha touch에서 MVC에 대한 단서가 없다면 sencha tutorial을 읽으십시오. 예 : http://docs.sencha.com/touch/2-0/#!/guide/controllers

+0

의 insted에 벨로의 설정을 추가 모시 : catch되지 않은 형식 오류를 : 개체 [개체 개체]있는 방법 '찾기' –

+0

이 없습니다 코드는 실제로 테스트되지 않았습니다. 죄송합니다. :) 귀하의 경우 항목은 배열입니다. – olegtaranenko

+0

흠 좋습니다.하지만 배열에서 코드가 어떻게 보이겠습니까? –

0

당신은 활성 세 번째 항목에 대한 tab.panel

activeItem :2 

이 오류를 얻기 첫번째

관련 문제