0
我試圖從數據庫中拉出幾條記錄,並將其顯示爲其中一個面板(或屏幕)上的列表。但我不能在屏幕上看到任何東西。請幫我,我錯了。sencha觸摸列表顯示
服務器返回一個JSON響應
{"success":true,"savedDeals":[
{"dealId":"17","dealName":"$2 Off Any Sandwich","dealText":"Valid with the purchase of any drink on Tuesday through Thursday from 11am to 4pm. Cannot be combined with other offers.","dealCategory":"Restaurant","dealCount":"0","dealRemaining":99999},
{"dealId":"21","dealName":"$10 OFF Kid's Clothing & Gifts","dealText":"Spend $50 and receive $10 off your total purchase","dealCategory":"Baby\/Kids","dealCount":"3","dealRemaining":3}
]}
模型是這樣的:
這家店看起來
myapp.stores.SSavedDeals = new Ext.data.Store({
model: 'myapp.models.savedDeals',
autoload: true,
id : 'savedDealsStore',
proxy: {
type: 'ajax',
url: '/myappfiles/savedDeals.php',
params: {
UserID: '62'
},
reader: {
type: 'json',
root: 'savedDeals',
}
},
});
和視圖看起來像
myapp.views.DealraiserSavedDeals = Ext.extend(Ext.Panel,{
fullscreen : true,
standardSubmit : false,
dockedItems: [{
xtype: 'toolbar',
title: 'Deals List',
dock: 'top',
items: [{
xtype: 'button',
text: 'Home',
ui: 'Home',
handler: function(){
myapp.views.viewport.setActiveItem(myapp.views.dealraiserHome , 'slide');
}
}]
},
],
items: [{
xtype: 'list',
id : 'savedList',
emptyText : 'No data available.',
store: myapp.stores.SSavedDeals,
itemTpl: '{dealName}'
}]
initComponent: function() {
myapp.stores.SSavedDeals.load();
myapp.views.DealraiserHome.superclass.initComponent.apply(this, arguments);
}
});
請幫忙,我該怎麼辦才能解決這個問題。
謝謝。
我做了這些更改,並嘗試通過使用'data:'屬性從商店本身加載數據來測試它。有效。但是,數據不是從php文件加載的。 關於如何從php文件加載數據的任何建議。 謝謝。 – user842122