ExtJS 4 Grid Panel - Spacebar row toggle

我是研究僧i 提交于 2019-12-25 15:15:42

问题


In ExtJS 4, selecting a row in a Grid Panel (by clicking it), and pressing the spacebar selects and de-selects the row. It was not like this in ExtJS 3, and I would like to disable this feature.

Any ideas? I've begin looking into Ext.util.KeyMap to see if I could override it somehow. Thanks in advance.


回答1:


You have to override the onKeyPress method of the the Ext.selection.RowModel. The shipped implementation is

onKeyPress: function(e, t) {
    if (e.getKey() === e.SPACE) {
        e.stopEvent();
        var me = this,
            record = me.lastFocused;

        if (record) {
            if (me.isSelected(record)) {
                me.doDeselect(record, false);
            } else {
                me.doSelect(record, true);
            }
        }
    }
}

Unfortunately there currently is no configuration switch to turn off that behavior.



来源:https://stackoverflow.com/questions/6791366/extjs-4-grid-panel-spacebar-row-toggle

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!