javascript ExtJS 4:将默认值应用于网格中的所有列

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6561120/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-25 21:06:45  来源:igfitidea点击:

ExtJS 4: Apply Defaults to all columns in a grid

javascriptextjs4

提问by Levi Hackwith

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

现在 ExtJS 4 摆脱了 ColumnModel 对象,你如何将默认配置选项应用于网格中的所有列?

回答by Levi Hackwith

Courtesy of Stevil on the Sencha Forums:

Sencha 论坛上的 Stevil 提供:

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
        }
    }
});