且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ExtJS 4网格面板-空格键行切换

更新时间:2022-01-04 06:21:24

您必须覆盖Ext.selection.RowModelonKeyPress方法.出厂的实现是

You have to override the onKeyPress method of 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.