开发者

ExtJS add hotkey

I want to add hotkey func开发者_如何学Gotionality to my page.

Ext.onReady(function () {
    Ext.util.KeyMap(document, {
        key: 'abc',
        handler: function () {
            alert("Hotkey was pressed!");
        }
    });
});

But the event doesn't occurs.


Ext 3.3.1 :

Ext.onReady(function () {
    new Ext.KeyMap(document, {
        key: 'abc',
        fn: function () {
            alert("Hotkey was pressed!");
        }
    });
});

in Ext 4.0.2.a :

Ext.onReady(function () {
    var map = new Ext.util.KeyMap(document,{
            //key : "abc" //doesn't work (mybe a bug)
            key: [65,66,67], // this works,
            fn: function(){ alert('a, b or c was pressed'); }
        }
    );
});


Use fn key, not handler in params

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜