Levi Hackwith
Levi Hackwith

Reputation: 9322

ExtJS 4: Apply Defaults to all columns in a grid

Now that ExtJS 4 got rid of the ColumnModel object, how do you apply default config options to all columns in a grid?

Upvotes: 19

Views: 13911

Answers (1)

Levi Hackwith
Levi Hackwith

Reputation: 9322

Courtesy of Stevil on the Sencha Forums:

var mygrid = Ext.create('Ext.grid.Panel', {
    //... store config, other config..., 
    columns: {
        items: [{
            header: 'Kd.-Nr.',
            dataIndex: 'id',
            width: 65,
            hidden: false
        }, {
            header: 'Firma',
            dataIndex: 'company_name'
        }],
        defaults: {
            sortable: true,
            hidden: true,
            width: 100
        }
    }
});

Upvotes: 32

Related Questions