2014-01-08 2 views
0

기본보기가있는 간단한 Sencha App이 있습니다. 이 뷰는 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 또는 문제의 작동 예제를 게시 할 수 있습니까?

관련 문제