Ext JS 4.2:如何禁用网格中的折叠分组

时间:2014-11-14 17:52:41

标签: javascript extjs

我有一个启用了分组的​​网格。但我想禁用折叠组项的能力

有什么想法吗?

由于 Tharahan

1 个答案:

答案 0 :(得分:0)

http://docs-origin.sencha.com/extjs/4.2.2/#!/api/Ext.grid.feature.Grouping-cfg-collapsible

  

collapsible:Boolean

     

设置为false可禁用从UI中折叠组。当关联的商店被缓冲时,这将设置为false。

     

默认为:true

在网格上使用features: [{ftype:'grouping', collapsible: false}],

Ext.application({
    name: 'Fiddle',

    launch: function() {
        var store = Ext.create('Ext.data.Store', {
            storeId: 'employeeStore',
            fields: ['name', 'seniority', 'department'],
            groupField: 'department',
            data: {
                'employees': [{
                    "name": "Michael Scott",
                    "seniority": 7,
                    "department": "Management"
                }, {
                    "name": "Dwight Schrute",
                    "seniority": 2,
                    "department": "Sales"
                }, {
                    "name": "Jim Halpert",
                    "seniority": 3,
                    "department": "Sales"
                }, {
                    "name": "Kevin Malone",
                    "seniority": 4,
                    "department": "Accounting"
                }, {
                    "name": "Angela Martin",
                    "seniority": 5,
                    "department": "Accounting"
                }]
            },
            proxy: {
                type: 'memory',
                reader: {
                    type: 'json',
                    root: 'employees'
                }
            }
        });

        Ext.create('Ext.grid.Panel', {
            title: 'Employees',
            store: Ext.data.StoreManager.lookup('employeeStore'),
            columns: [{
                text: 'Name',
                dataIndex: 'name',
                flex: 1
            }, {
                text: 'Seniority',
                dataIndex: 'seniority',
                flex: 1
            }],
            features: [{
                ftype: 'grouping',
                collapsible: false
            }],
            width: 500,
            renderTo: Ext.getBody()
        });
    }
});
<script src="https://extjs.cachefly.net/ext/gpl/4.2.1/ext-all-debug.js"></script>
<link href="https://extjs.cachefly.net/ext/gpl/4.2.1/packages/ext-theme-classic/build/resources/ext-theme-classic-all.css" rel="stylesheet"/>