checkbox - EXTJS:如何确定是否已单击数据网格中的标题复选框
问题描述
我想知道是否已单击 headerCheckbox(全选)。我在这里从 sencha fiddle 得到了这个例子:
https://fiddle.sencha.com/#fiddle/1gvv&view/editor
`Ext.application({ name: 'Fiddle', launch: function() {
// Define our data model
Ext.define('MyModel', {
extend: 'Ext.data.Model',
fields: ['firstField', 'secondField']
});
// Generate mock data
var data = [{
"firstField": "one",
"secondField": "1"
}, {
"firstField": "two",
"secondField": "2"
}, {
"firstField": "three",
"secondField": "3"
}, {
"firstField": "four",
"secondField": "4"
}, {
"firstField": "five",
"secondField": "5"
}];
// create the Data Store
var store = Ext.create('Ext.data.Store', {
// destroy the store if the grid is destroyed
autoDestroy: true,
model: 'MyModel',
proxy: {
type: 'memory'
},
data: data
});
var sm = new Ext.selection.CheckboxModel({
checkOnly: true,
listeners: {
selectionchange: 'onSelectionChange'
}
});
var grid = Ext.create('Ext.grid.Panel', {
store: store,
selModel: sm,
columns: [{
header: 'firstField',
dataIndex: 'firstField',
flex: 1
}, {
header: 'secondField',
dataIndex: 'secondField',
flex: 1
}],
tbar: [{
xtype: 'textfield',
fieldLabel: 'firstField',
itemId: 'mytextfield'
}, {
text: 'Select',
handler: function() {
// try to find the record having the firstField field as the entered one
var selectedRecord = grid.getStore().findRecord('firstField', grid.down('#mytextfield').getValue());
if (selectedRecord) {
grid.getSelectionModel().select(selectedRecord);
}
}
}]
});
new Ext.window.Window({
width: 700,
height: 400,
items: grid,
layout: 'fit',
closable: false
}).show();
}
});`
我已经放了onSelectionChange监听器,但是要在里面放什么才能知道是否单击了全选?
感谢您的帮助。
解决方案
推荐阅读
- python - Python:如何在 Firefox 中自动化“允许”Flash 播放器内容?
- javascript - TypeError:当我使用 React Context API 时,渲染不是一个函数
- spring-boot - 无法在 Springboot 应用程序中执行 groovy 测试文件
- javascript - 使用可随时间变化的二维过滤器数组过滤数据数组
- python - 用 Python 启动 lpksetup.exe
- c# - 使用结构的 C++ 字符串到 C#
- node.js - mongoose $sort 不适用于聚合
- android - 如何使用共享首选项保存评分栏值?
- bash - 即使我指定了执行它的程序,我是否需要在脚本名称之前指定 ./(点斜杠)?
- r - ggplot:绘制具有重复时间值的时间序列