Extjs5 Grid条件查询

Extjs5 Grid条件查询

问题描述:

查询结果可以出来,但grid上显示不出来,这是什么原因?求答

reader配置对了没有,rootProperty是否和数据源的数据集合名称一致

数据返回格式类似,rootProperty要配置为"rows"

 {
    "total": 122,
    "offset": 0,
    "rows": [
        {
            "id": "ed-spencer-1",
            "value": 1
        }
    ]
}

// 查询按钮
    Search = function () {
    var productname = Ext.getCmp('name').getValue();
    var productdesn = Ext.getCmp('code').getValue();
    Ext.Ajax.request({
        //请求地址
        url: '请求地址2',
        method: 'post',
        params: {
            Name: productname,
            Code: productdesn,
        },
        async: false,//Ext.Ajax.request默认是异步的,可以通过设置参数async:false来使其变为同步
        success: function (response, success) {
            girds = Ext.decode(response.responseText);//这里需要变为同步获取girds数据

        }
    });
    data.load();
};
//grid数据源
Ext.Ajax.request({
    //请求地址
    url: '请求地址1',
    method: 'post',
    async: false,//Ext.Ajax.request默认是异步的,可以通过设置参数async:false来使其变为同步
    success: function (response, success) {
        girds = Ext.decode(response.responseText);//这里需要变为同步获取girds数据
    }
});
data = new Ext.data.Store({
    id: 'dataStore',
    pageSize: 15,
    fields: ['Id', 'Code', 'Name', 'State'],
    autoLoad: true,
    proxy: new Ext.data.MemoryProxy({
        data: girds,//这里的girds数据由Ext.Ajax.request获取
        reader: {
            type: 'json'
        },
        enablePaging: true
    })
});
    我是这样写的,是不是有些地方不对啊?