所以我在这里有grid.Panel:
Ext.require([
'Ext.direct.*',
'Ext.data.*',
'Ext.grid.*'
]);
Ext.define('PersonalInfo', {
extend: 'Ext.data.Model',
fields: [ 'name', 'email']
});
Ext.onReady(function() {
// create the Grid
Ext.create('Ext.grid.Panel', {
store: {
model: 'PersonalInfo',
autoLoad: true,
proxy: {
type: 'ajax',
url : 'app/data/users.json',
reader: {
type: 'json',
root: 'users'
}
}
},
columns: [{
dataIndex: 'name',
width: 50,
text: 'ID'
}],
height: 450,
width: 700,
title: 'Velociraptor Owners',
renderTo: Ext.getBody()
});
});
这里的users.json文件,扩展名是app / data / users.json:
{
"users": [
{ "name": "Name 1" , "email": "email@site.com" },
{ "name": "Name 2" , "email": "email@site.com" },
{ "name": "Name 3" , "email": "email@site.com" },
{ "name": "Name 4" , "email": "email@site.com" },
{ "name": "Name 5" , "email": "email@site.com" }
]
}
网格显示在我的浏览器上(Firefox。IE9没有显示任何内容),但没有像我告诉的那样显示“名称”字段。有什么想法吗?