在 Extjs 4 Grid 使用 checkcolumn , 如果我们希望此列不可编辑, 查看 API doc 文档, Extjs 4 提供了 stopSelection 属性来控制
stopSelection : Boolean
Prevent grid selection upon mousedown.
Defaults to: true
但是问题出现了, 即使设置了 stopSelection 为 false, 发现 checkcolumn 列还是可以点击改变状态
查看源代码, 发现代码里也没有处理(是不是 extjs 4 的 bug), 自己动手重新覆盖 prcoessEvent 方法就可以了
Ext.override(Ext.grid.column.CheckColumn, {
processEvent: function(type, view, cell, recordIndex, cellIndex, e, record, row) {
var me = this,
key = type === 'keydown' && e.getKey(),
mousedown = type == 'mousedown';
if (!me.disabled && (mousedown || (key == e.ENTER || key == e.SPACE))) {
var dataIndex = me.dataIndex,
checked = !record.get(dataIndex);