2014-01-08 31 views
0

我有一個簡單的Sencha應用程序,它有一個主視圖。該視圖擴展了Ext.navigation.View,以便當用戶選擇列表中的項目時,我可以「推送」到新視圖。這是通過設置一個監聽器然後在MainView對象上調用push函數來實現的。Sencha Touch 2.3.1 - onTap()記錄參數返回空對象

但是,我在將數據傳送到該視圖時遇到問題。我嘗試使用this StackOverflow question的答案,但它不起作用。

在該答案中,它建議您使用itemTap()函數的record參數,但是這返回爲空對象。

爲什麼record作爲空對象返回?

也許我這樣做是錯誤的?

就我而言,我有一個「品牌」列表,每個品牌都有一個標題,圖片和說明。我想用在在滑動面板。

我的應用程序的啓動函數創建視圖和廣告視窗

launch: function() { 
    // Destroy the #appLoadingIndicator element 
    Ext.fly('appLoadingIndicator').destroy(); 

    // Create instance of the main view so we can use it's functions 
    SenchaTest.MainView = Ext.create('SenchaTest.view.Main'); 

    // Initialize the main view 
    Ext.Viewport.add(SenchaTest.MainView); 
}, 

這是我的看法

Ext.define('SenchaTest.view.Main', { 
    extend: 'Ext.navigation.View', 
    xtype: 'main', 

    requires: [ 
     'Ext.TitleBar', 
     'Ext.Video', 
     'Ext.carousel.Carousel', 
     'Ext.Img' 
    ], 

    config: { 
     fullscreen: true, 

     items: [ 
      { 
       title: 'Test', 

       layout: { 
        type: 'vbox', 
        align: 'stretch' 
       }, 

       items: [{ 
       xtype: 'highlightscarousel', 
       flex: 0.35 
       }, { 
       xtype: 'list', 
       displayField: 'title', 
       flex: 0.65, 

       store: Ext.create('SenchaTest.store.Brands'), 
       itemTpl: '<img src="{image}" class="listThumb"><h1 class="listTitle">{name}</h1><span class="clearFloat"></span>', 

       listeners: { 
        itemtap: function(nestedList, list, index, element, post, record) { 

        } 
       } 
       }] 
      } 
     ] 
    } 
}); 

回答

0

基礎上煎茶觸摸文檔中,itemtap聽者的簽名是:

(this, index, target, record, e, eOpts) 

你使用:

(nestedList, list, index, element, post, record) 

所以這可能是爲什麼該記錄是一個空的對象。如果情況並非如此,你可以發佈一個JSFiddle或某種工作示例的問題嗎?