0
我試圖在浮動面板內加載列表。它適用於靜態值,但不會使用json文件加載。Sencha Touch 2商店不在浮動面板內加載
如果我想這和它的作品:
var panel = Ext.create('Ext.Panel', {
left: 0,
padding: 10,
width: 300,
height: 300,
modal: true,
hideOnMaskTap: true,
layout: 'fit',
items: [
{
xtype: 'list',
scrollable: true,
ui: 'round',
height: '100%',
store: {
fields: ['name'],
data: [
{name: 'Cowper'},
{name: 'Everett'},
{name: 'University'},
{name: 'Forest'}
]
},
itemTpl: '{name}'
}
]
});
但是,當我嘗試調用一個JSON文件,這是行不通的。這是面板:
var panel = Ext.create('Ext.Panel', {
left: 0,
padding: 10,
width: 300,
height: 300,
modal: true,
hideOnMaskTap: true,
layout: 'fit',
items: [
{
xtype: 'list',
scrollable: true,
ui: 'round',
height: '100%',
store: 'storeCardStatus',
itemTpl: '{Card_Status}'
}
]
});
這是商店:
Ext.define('MyApp.store.storeCardStatus',{
extend: 'Ext.data.Store',
config: {
model: 'MyApp.model.modelCardStatus',
autoLoad: true,
proxy: {
type: 'ajax',
url : 'card_status.json',
reader: 'json'
}
}
});
這是模型:
Ext.define('MyApp.model.modelCardStatus', {
extend: 'Ext.data.Model',
config: {
fields: [
{name: 'Card_Status', type: 'string'}
]
}
});
這是JSON文件:
[
{"Card_Status": "Completed"},
{"Card_Status": "Issued"},
{"Card_Status": "In Use"}
]
你的pannel似乎在它充滿數據之前被渲染? –
鉻控制檯中的任何錯誤? –