extjs 我们可以对网格检查列做同样的事情吗?

chhkpiq4  于 2023-04-11  发布在  其他
关注(0)|答案(2)|浏览(91)

我想做一些类似的小提琴:https://fiddle.sencha.com/#view/editor&fiddle/20rt,但不同的是,他已经做了checkboxxtype,但我想它为checkcolumn。请让我知道,如果我们可以这样做?

piah890a

piah890a1#

你可以使用xtype:'checkcolumn'到网格列来实现这一点。请参考以下内容:https://docs.sencha.com/extjs/7.6.0/classic/Ext.grid.column.Check.html

var store = Ext.create('Ext.data.Store', {
    data: [{
        active: true
    }, {
        active: true
    }, {
        active: false
    }, {
        active: true
    }]
});

Ext.create('Ext.grid.Panel', {
    height: 200,
    width: 400,
    renderTo: Ext.getBody(),
    store: store,
    columns: [{
        xtype: 'checkcolumn',
        text: 'Status',
        dataIndex: 'active'
    }]
});
nwlqm0z1

nwlqm0z12#

您可以使用headerCheckboxconfig. configureastrue在标题文本下方显示复选框。
单击复选框将选中/取消选中所有记录。

Ext.create('Ext.grid.Panel', {  
    columns: [{
        xtype: 'checkcolumn', 
        headerCheckbox:true, 
    }]
});

相关问题