我尝试使用下面的代码来填充从商店的ExtJS的网格面板:
app.js
Ext.define('UC', {
extend: 'Ext.data.Model',
fields: ['PMNumber']
});
var ds = Ext.create('Ext.data.Store', {
storeID :'s',
model: 'UC',
proxy: {
type:'ajax',
url:'data.php',
reader: {
type : 'json',
root: "myInventory",
fields: [
{name: 'PMNumber', type: 'int', mapping: 'PMNumber'},
]
}
}
});
Ext.onReady(function()
{
ds.load();
Ext.create('Ext.grid.Panel', {
title: 'Attendanace',
store: Ext.data.StoreManager.lookup('s'),
columns: [
{ int: 'PMNumber', dataIndex: 'PMNumber' }
],
height: 200,
width: 400,
renderTo: document.getElementById('aa')
});
});
data.php以JSON格式时单独调用返回以下数据
{"myInventory":[{"PMNumber":"2003010001"},{"PMNumber":"2003010002"}]}
任何人我在哪里丢失的?
谢谢