我是 ExtJs 的新手,我无法以任何形式将 JSON 数据加载到网格中——无论是内联还是从静态 JSON 数据文件。非常感谢任何帮助。
只显示空网格 - 没有任何数据。
var Grid1Store = new Ext.data.JsonStore({ root: 'users', fields: [ 'id', 'name', 'email' ], autoLoad: true, data: { users: [ { "id": 1, "name":"John Smith", "email":"jsmith@example.com"}, { "id": 2, "name":"Anna Smith", "email":"asmith@example.com"}, { "id": 3, "name":"Peter Smith", "email":"psmith@example.com"}, { "id": 4, "name":"Tom Smith", "email":"tsmith@example.com"}, { "id": 5, "name":"Andy Smith", "email":"asmith@example.com"}, { "id": 6, "name":"Nick Smith", "email":"nsmith@example.com"} ]} }); var onReadyFunction = function(){ var grid = new Ext.grid.GridPanel({ renderTo: Ext.getBody(), frame: true, title: 'Database', width:300, store: Grid1Store, columns: [ {text: "Id", dataIndex: 'id'}, {text: "Name", dataIndex: 'name'}, {text: "Email", dataIndex: 'email'} ] }); } Ext.onReady(onReadyFunction);