2011-11-20 19 views
2

我瞭解,通過調用MyDetailView.Update(record.data)我送record.data到MyDetailView並且可以在xtemplate訪問它們:煎茶觸摸傳遞從組件變量組件

tpl:'<h1>{title}></h1>' 

此外,我想在xtype'map'項中使用record.data:

items: [ 
    { 
    xtype: 'map', 
    getLocation: true, 
    padding: '20 0 0 0', 
    mapOptions: { 
     center : new google.maps.LatLng(lng, lat), // <-- here record.data.lat 
     zoom : 15, 
     mapTypeId : google.maps.MapTypeId.ROADMAP, 
     navigationControl: true, 
     navigationControlOptions: { 
     style: google.maps.NavigationControlStyle.DEFAULT 
     } 
    } 
    } 
] 

如何訪問MyDetailView中的數據?

感謝

----------------編輯------------------

我添加我的完整代碼。在列表視圖中,我調用AppDetailcard.update(record.data)。

var AppDetailcard = new Ext.Panel ({ 
    id: 'detailcard', 
    styleHtmlContent: false, 
    tpl: 'my {lat}', //<-- here it works 
    fullscreen: true, 
    dockedItems: [AppDetailcardToolbar], 
    items  : [ 
     { 
      xtype: 'map', 
      getLocation: true, 
      mapOptions: { 
       center : new google.maps.LatLng(data.lat, data.lng), //<-- here it does not 
       zoom : 15, 
       mapTypeId : google.maps.MapTypeId.ROADMAP, 
       navigationControl: true, 
       navigationControlOptions: { 
       style: google.maps.NavigationControlStyle.DEFAULT 
          } 

      } 
     } 
    ] 
+0

看着這段代碼,我猜這可能是this.lng&this.lat? –

+0

@MozMorris我忘了提,我沒有成功嘗試過。雖然它不會拋出任何錯誤,但GMap根本不會顯示。 – Matthieu

回答

0

你也必須新的記錄到你的項目數組。

this.down('map').setMapCenter({ 
    latitude: newRecord.data.latitude, 
    longitude: newRecord.data.longitude 
}); 

我平時推記錄,沒有數據,到視圖,然後使用updateRecord事件接受記錄並進一步推下來的項目陣列。

看看Sencha網站上的導航視圖示例,它們在Show.js視圖文件中完成該操作。