fastcodejava
fastcodejava

Reputation: 41117

Pass extra parameters with new tab Extjs4

​To add a grid, I have this code. How I ​​​pass extra parameters to 'myGrid'?

tabPanel.add({ xtype : 'myGrid' });

Upvotes: 0

Views: 404

Answers (2)

user3283976
user3283976

Reputation: 179

Yes you can pass parameters and other properties like this:

var addGrid=function (store){
    tabPanel.add({
        xtype: 'myGrid',
        autoScroll: true,
        **store: store, //parameter** 
        columns: [{
            text: 'Company',
            flex: 1,
            sortable: true,
            dataIndex: 'company'
        }, {
            text: 'Price',
            flex: 1,
            sortable: true,
            dataIndex: 'price'
        }],
        viewConfig: {
            autoFit: true
        }
    });
}

Upvotes: 2

Taylor Maxwell
Taylor Maxwell

Reputation: 146

You can pass a value to the grid with this syntax

var grid = Ext.create('{NAMESPACE PATH HERE}.view.myGrid', { id: id}); tabPanel.add(grid);

Upvotes: 1

Related Questions