2012-03-27 57 views
0

我是sencha的新手,我不知道如何將一些組件添加到我的面板中。我找不到任何有關這方面的信息,所以我認爲這很容易實現,我真的不知道如何開始。我喜歡這裏顯示的設計:http://dev.sencha.com/deploy/touch/examples/production/kiva/,但是在開始使用教程之後,即使採用設計方式,我也無法複製此項目。拜託,夥計們,幫助我如何處理這...將幾個組件添加到Sencha Touch 2的一個視圖中

舉例來說,如果我有我的主視圖(Main.js)看起來像這樣:

Ext.define("GS.view.Main", { extend: 'Ext.tab.Panel', 
    requires: ['Ext.TitleBar'], 

    config: { 
     tabBarPosition: 'top', 
     cetner: true, 

     items: [ 
      { 
       xtype: 'profile' 
      }, 
      { 
       xtype: 'map'   
      }, 
     ] 
    } 
}); 

和位置:

Ext.define('GS.view.Position', { extend: 'Ext.Map', 

    xtype: 'map', 

    config: { 
     title: 'Position', 
     iconCls: 'time', 
     useCurrentLocation: true, 
     mapOptions: { 
      zoom: 19 
     }, 
     listeners: { 
      maprender : function(comp, map){ 
       new google.maps.Marker({ 
        position: new google.maps.LatLng(this._geo.getLatitude(), this._geo.getLongitude()), 
        map: map 
       });  



      } 


     } 
    } 
}); 

如何添加一些額外的組件到我的位置視圖?

感謝 米沃什

回答

0

首先,我注意到你的xtype:處在你的位置視圖「地圖」,刪除該行並用別名替換它。與您需要添加一個別名配置類似的xtype打電話給你的位置視野

alias:'widget.mymap' 

不要只是名字你的別名地圖,因爲它會混淆煎茶。

然後在主視圖中做一些事情,像這樣

items: [ 
     { 
      xtype: 'profile' 
     }, 
     { 
      xtype: 'mymap'   
     }, 
     ] 
+0

我一直在尋找一些其他的解決方案,但真的感謝您的建議。 – milosz0010 2012-03-27 19:07:19

相關問題