2013-02-01 98 views
0

嗨,我如何創建一個工具欄的旋轉木馬,想要點擊切換視圖,也刷卡切換視圖的選項,這裏是我的代碼,當我運行這個工具欄內的xtypes不顯示在一個工具欄?帶有工具欄的Sencha Touch 2 Carousel?

由於

Ext.define("NF.view.tablet.MainH", { 
    extend: 'Ext.tab.Panel', 
    requires: ['Ext.TitleBar'], 


    config: { 
    tabBar: { 
     hidden: true},  

    items: [ 

    { 
     xtype : 'toolbar', 
     docked: 'top', 
     title: '', 
     layout:'hbox', 
     items:[ 

       {xtype: 'home'} , 
       {xtype:'tablet-placesContainer'}, 
       {xtype:'tablet-About'}, 
       {text: 'contact'}, 
       { xtype: 'contactpage'}, 
       {xtype: 'home3'} , 
       ], 

    }, 



    { 
    xtype:'carousel', 
    layout:'fit', 
    iconCls: 'home', 
     items:[ 

     {xtype: 'home'} , 

     {xtype:'tablet-placesContainer'}, 

     {xtype:'tablet-About'}, 

     {xtype: 'gallery'}, 

     { xtype: 'contactpage'}, 

     {xtype: 'home3'} , 

     ] 
    }] 
    } 

});

When I run this the toolbar info is not showing up.  

回答

1

我可能會誤解你的問題,但也許你最好的選擇是

1)使每個工具欄項目與HTML一個簡單的按鈕,轉盤項

2名)給出旋轉木馬的名稱

3)只爲每個工具欄項目的輕敲事件,設置正確的活動項目:

Ext.define("NF.view.tablet.MainH", { 
    extend: 'Ext.tab.Panel', 
    requires: ['Ext.TitleBar'], 


    config: { 
    tabBar: { 
     hidden: true},  

items: [ 

{ 
    xtype : 'toolbar', 
    docked: 'top', 
    title: '', 
    layout:'hbox', 
    items:[ 

      {xtype:'button',text: 'home', handler:function(){Ext.getCmp('carousel_name').setActiveItem(0)}} , 
      {xtype:'button',text: 'places', handler:function(){Ext.getCmp('carousel_name').setActiveItem(1)}} , 
      ], 

}, 



{ 
xtype:'carousel', 
id:'carousel_name', 
layout:'fit', 
iconCls: 'home', 
    items:[ 

    {xtype: 'home'} , 

    {xtype:'tablet-placesContainer'}, 

    {xtype:'tablet-About'}, 

    {xtype: 'gallery'}, 

    { xtype: 'contactpage'}, 

    {xtype: 'home3'} , 

    ] 

}] }