ExtJS4.2 Ext.grid.panel Store更改后刷新表格

    ////////////////////////
    // Prepare store
    ////////////////////////

    // prepare fields and columns
    var __fields = [];
    var __columns = [];

    for (var jj=0; jj<config.columns.length; jj++) {
        var item2 = {};
        var item = [];
        // for fields
        item.name = config.columns[jj].title;
        __fields.push (item);
        // for columns
        item2.xtype = 'gridcolumn';
        item2.dataIndex = config.columns [jj].dataIndex;
        item2.text = config.columns [jj].title;
        __columns.push (item2);    
    }

    console.debug ('columns.length = ' + __columns.length + ', fields.length = ' + __fields.length);

    var sm = new Ext.selection.RowModel();
    //sm.bindComponent (grid.getView ());

    var __store = Ext.create ('Ext.data.Store', {
        storeId: config.storeId,
        fields: __fields,
        selModel: sm,
        proxy: {
            type: 'ajax',
            url: '/rhidmo/rest/ktec_js_searchUtils',
            reader: {
                type: 'json',
                root: 'entries'
            }
        }
    });

    grid.reconfigure (__store, __columns);

 更新绑定的bbar分页栏:

barPagingBar.bindStore(__store,true); 
barPagingBar.updateInfo();
barPagingBar.moveFirst();

 

posted @ 2014-04-25 15:26  qingbin_bai  阅读(8277)  评论(0编辑  收藏  举报