tags:

views:

135

answers:

1

When I'm adding items to the grid's store and grid is not visible at that moment then grid is not populated with items. Is there any fix or workaround for this?

Here is the code (switch to "tab1", click button, switch back to "tab2" — grid is empty):

var tbar = {
    items: [{
        text: 'add some lines',
        handler: function() {
            Ext.getCmp('grid-panel').store.loadData([[1, 'aaaaa'], [2, 'bbbbb']]);
        }
    }]
};

Ext.onReady(function() {
    var p = new Ext.TabPanel({
        renderTo: 'panel-div',
        width: 500,
        height: 350,
        title: '123123',
        activeItem: 1,
        items: [{
            title: 'tab1',
            tbar: tbar
        },{
            title: 'tab2',
            layout: 'fit',
            tbar: tbar,
            items: {
                xtype: 'grid',
                hideHeaders: true,
                id: 'grid-panel',
                autoExpandColumn: 'text',
                columns: [{id: 'text', header: 'Category', width: 1, dataIndex: 'text'}],
                store: new Ext.data.ArrayStore({
                    fields: ['id', 'text']
                })
            }
        }]
    });
});
A: 

grid.getView().refresh() should reload the grid.

BrennaSoft
nope, actually it's a bug http://www.extjs.com/forum/showthread.php?t=95233
Sergei Stolyarov