Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 857
Levi Hackwith Avatar asked Jul 03 '11 04:07

Levi Hackwith


1 Answers

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
        }
    }
});
like image 187
Levi Hackwith Avatar answered Sep 28 '22 03:09

Levi Hackwith