2012-10-17 31 views
3

Ext.List沒有填滿店鋪的數據,只顯示兩行空白列表項目。當我用firebug進行調試時,我看到商店裏充滿了json數據中的信息,但是沒有顯示列表項。Sencha Touch Ext.List沒有填寫店鋪的數據

存儲對象

Ext.define('MyApp.store.ListStore', { 
extend: 'Ext.data.Store', 
autoLoad: true, 

config: 
{ 
    model: 'MyApp.model.NewsData', 
    fields: [{ name: 'haberId', mapping: 'haberId' }, 
      { name: 'haberGonderen', mapping: 'haberGonderen' }, 
      { name: 'haberDetay', mapping: 'haberDetay' }, 
      { name: 'haberZaman', mapping: 'haberZaman'}] 
}, 

proxy: { 
    id: 'ListStore', 
    access: 'public' 
}}); 

新聞對象

Ext.define('MyApp.model.NewsData', { 
extend: "Ext.data.Model", 
config: { 
    fields: [ 
     'haberId', 
     'haberGonderen', 
     'haberDetay', 
     'haberZaman' 
    ] 


}}); 

列表視圖

Ext.define('MyApp.view.ListTemplate', { 
extend: 'Ext.List', 
title: 'Haber Listesi', 
store : 'ListStore', 
fullscreen: true, 
itemTpl : '{haberGonderen}'}); 

任何人有任何想法?

回答

1

試試這個。可能會幫助你。

Store.js

 Ext.define('MyApp.store.ListStore', { 
     extend: 'Ext.data.Store', 
     config: 
     { 
      autoLoad: true, 
      model: 'MyApp.model.NewsData', 
      proxy: { 
      id: 'ListStore', 
      access: 'public' 
      }, 
      fields: [{ name: 'haberId', mapping: 'haberId' }, 
        { name: 'haberGonderen', mapping: 'haberGonderen' }, 
        { name: 'haberDetay', mapping: 'haberDetay' }, 
        { name: 'haberZaman', mapping: 'haberZaman'}] 
     } 

     }); 

ListTemplate.js

 Ext.define('MyApp.view.ListTemplate', { 
     extend: 'Ext.List', 
     config: { 
     fullscreen: true, 
     title: 'Haber Listesi', 
     store : 'ListStore', 
     itemTpl : '{haberGonderen}' 
     } 

     }); 
+0

謝謝你的回答,它解決了我的問題。 – handet87