ExtJs 4网格未填充数据

ExtJs 4网格未填充数据,extjs,extjs4,Extjs,Extjs4,我试图用json数据填充ExtJS4网格。不幸的是,无论我做什么,它仍然是空的。JS函数如下所示: function buildGrid() { Ext.define('Contact', { extend: 'Ext.data.Model', fields: ['Id', 'Name', 'State', 'Age'] }); var store = Ext.create('Ext.data.Store', { model: 'Contact', proxy

我试图用json数据填充ExtJS4网格。不幸的是,无论我做什么,它仍然是空的。JS函数如下所示:

function buildGrid() {

Ext.define('Contact', {
    extend: 'Ext.data.Model',
    fields: ['Id', 'Name', 'State', 'Age']
});

var store = Ext.create('Ext.data.Store', {
    model: 'Contact',
    proxy: {
        type: 'ajax',
        url: 'GridData',
        reader: {
            type: 'json',
            record: 'data',
            totalProperty: 'total'
        }
    }
});

var grid = Ext.create('Ext.grid.Panel', {
    store: store,
    columns: [
        { text: "Name", flex: 1, width: 120, dataIndex: 'Name', sortable: true },
        { text: "State", width: 100, dataIndex: 'State', sortable: true },
        { text: "Age", width: 115, dataIndex: 'Age', sortable: true },
    ],
    height: 210,
    width: 600,
    split: true,
    renderTo: Ext.getBody()
}).show();

}

Ext.onReady(buildGrid);
服务器响应如下所示:

{"callback":"1307878654818","total":1,"data":[{"Id":"ac2bedf1-bb5c-46e0-ba50-a6628341ca25","Name":"Smith","State":"NU","Age":24}]}
看起来还可以。但是,网格视图没有显示日期


任何人都可以看到我做错了什么?

您没有指定root属性。试一试

reader: {
            type: 'json',
            root: 'data',
            totalProperty: 'total'
        }

太神了就这样!非常感谢你!