问题
I am trying to populate an ExtJS grid Panel from a Store using the following code :
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 is returning Following data in JSON format when called separately
{"myInventory":[{"PMNumber":"2003010001"},{"PMNumber":"2003010002"}]}
Anybody where am I missing?
Thanks
来源:https://stackoverflow.com/questions/15312320/ext-grid-panel-not-loading-data-from-ext-data-store