所以我将 json 加载到商店,但网格中没有可见的数据。我究竟做错了什么?这是网格:
{
xtype: 'gridpanel',
title: 'Clients List',
store: Ext.create('Ext.data.Store', {
model: 'app.model.modelClients',
proxy: Ext.create('Ext.data.HttpProxy', {
type: 'ajax',
headers: { 'Accept': 'application/json' },
url: 'client.php',
noCache: false,
startParam: undefined,
filterParam: undefined,
limitParam: undefined,
pageParam: undefined
}),
reader: new Ext.data.JsonReader({
root: 'records',
id: 'id',
fields: ['first_name', 'last_name', 'phone']
}),
listeners: {
load: function (self, records, successful, eOpts) {
var fields = records[0].fields;
console.log(fields.getAt(0));
}
},
autoLoad: true
}),
flex: '1',
columns: [
{ text: 'Name', dataIndex: 'first_name' },
{ text: 'Last Name', dataIndex: 'last_name' },
{ text: 'Phone', dataIndex: 'phone' }
]
}