ExtJs:grid.reconfigure错误" Uncaught TypeError:无法读取属性' getProxy'未定义"

时间:2015-09-14 16:27:25

标签: extjs dynamic grid store

即时尝试构建动态网格,可以从

创建商店
var data = JSON.parse(response.responseText),
columns = data.columns;
var store = Ext.create('Ext.data.Store', {
    data: data
    })

因为我想重新配置我在window.js中显示的网格

grid.reconfigure({
        columns: columns,
        store : store
    });

1 个答案:

答案 0 :(得分:2)

这是%100动态网格:小提琴:https://fiddle.sencha.com/#fiddle/trn

Ext.Ajax.request({
            url: 'users',
            success: function(response) {
                var resp = Ext.JSON.decode(response.responseText).records;
                var columnKeys = Object.keys(resp[0]);
                var store1 = Ext.create('Ext.data.Store', {
                    fields: columnKeys,
                    data : resp
                });
                var columnObjects = []
                Ext.each(columnKeys, function(key) {
                    columnObjects.push({
                        text: key,
                        dataIndex: key
                    });
                });
                var grid = Ext.create('Ext.grid.Panel', {
                    columns: columnObjects,
                    store: store1,
                    renderTo: Ext.getBody()
                }); 
            }

        });