我想做一些类似于这个小提琴的事情:https://fiddle.sencha.com/#view/editor&fiddle/20rt 但不同的是,他已经为 checkbox xtype 做了,但我想要它为 checkcolumn 。如果我们可以这样做,请告诉我?
您可以使用 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'
}]
});
您可以使用 headerCheckbox 配置。 配置为 true 以在标题文本下方显示一个复选框。
单击复选框将选中/取消选中所有记录。
Ext.create('Ext.grid.Panel', {
columns: [{
xtype: 'checkcolumn',
headerCheckbox:true,
}]
});