开发者

ExtJS 4 Grid Panel - Spacebar row toggle

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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜