1. 程式人生 > >修復Extjs5.1.4表格設置enableTextSelection: true之後,文本仍然不能選擇的BUG

修復Extjs5.1.4表格設置enableTextSelection: true之後,文本仍然不能選擇的BUG

over del ble nav targe find ret lec parent

如果您發現其他版本也有此BUG,可參照此方式進行修復,源代碼中多了一句攔截mousedown事件的代碼mousedownEvent.preventDefault()造成的。
Ext.define(‘Ext.override.grid.NavigationModel‘,{
override:‘Ext.grid.NavigationModel‘,
onCellMouseDown: function(view, cell, cellIndex, record, row, recordIndex, mousedownEvent) {
var parentEvent = mousedownEvent.parentEvent,
targetComponent = Ext.Component.fromElement(mousedownEvent.target, cell),
column = mousedownEvent.position && mousedownEvent.position.column,
cellEditing = view.grid.findPlugin(‘cellediting‘);

if (targetComponent && targetComponent.isFocusable && targetComponent.isFocusable()) {
if (!cellEditing || !cellEditing.editing) {
targetComponent.focus();
}
if (column && column.stopSelection !== false) {
return;
}
}
if (!parentEvent || parentEvent.type !== ‘touchstart‘) {
this.setPosition(mousedownEvent.position, null, mousedownEvent);
}
}
});

修復Extjs5.1.4表格設置enableTextSelection: true之後,文本仍然不能選擇的BUG