Extjs4-如何从返回的json生成网格?

Extjs4-如何从返回的json生成网格?,extjs4,Extjs4,我有一个表单和一个网格来提交查询,如下所示: items:[ { fieldLabel: 'query the month', xtype : 'textfield', name : 'query_year_month', id: 'query_year_month' } ], buttons: { text: 'submit', formBind: true, //only e

我有一个表单和一个网格来提交查询,如下所示:

items:[  
{  
     fieldLabel: 'query the month',  
     xtype     : 'textfield',  
     name      : 'query_year_month',  
     id:   'query_year_month'  
} ],  

buttons:  {  
    text: 'submit',  
    formBind: true, //only enabled once the form is valid  
    disabled: false,
    handler: function() {
        //some code         
        }

var store = Ext.create('Ext.data.Store', {
        model: //uncertain,
        region : 'south',
        pageSize: 15,

        proxy: {
            type: 'ajax',
            url : 'brokee/brokagequery/',
            reader: {
            type: 'json',
            root: 'users'
            }
        },

        autoLoad: false    
});
我想在提交表单后将数据加载到网格中。返回的数据是json
结构,我不想定义绑定到存储和网格列的静态模型,因为返回的数据是不确定的。存储模型和网格列应根据json数据生成, 例如:json:{'field1':data1,'field2':data2} 模型应按如下方式生成:

Ext.define('somemodel', {
    extend: 'Ext.data.Model',
    fields: [
        {name: 'field1', type: 'string'},
        {name: 'field2', type: 'string'}
               ]
});

在正式演示中,存储和模型是预定义的,然后通过代理调用store.load方法刷新网格。但是,当需要生成存储和模型时,我该怎么做呢?

加载json后,可以像这样创建存储/模型。。。。使用record.raw提取值,并:

Ext.create("Ext.data.JsonStore",{
    id:record.raw.storeID,
    model: Ext.define('App.dataGridModel', {
        extend: 'Ext.data.Model',
        fields: [record.raw.id, record.raw.first]...
    })
...

});
网格等也一样