4

デフォルトのブラウザー アクションCTRL+を停止Sし、ユーザーがアプリケーションでこのキーの組み合わせを押している間、RIA にフォーム データを保存させたいと考えています。

ExtJS 4.1.x を使用しています

ここで jQuery を使用した同様のソリューション: Best cross-browser method to capture CTRL+S with JQuery?

4

1 に答える 1

3

ExtJSアプリで通常行う方法は次のとおりです(以下の最後のケースステートメント)。私にとってはうまくいくようです:

// attach key navigation to document
Ext.getDoc().on('keypress', function(event, target) {
    if (event.ctrlKey && !event.shiftKey) {
        event.stopEvent();

        switch(event.getKey()) {

            case event.LEFT :
                this.shiftTabs(-1);
                break;

            case event.RIGHT :
                this.shiftTabs(1);
                break;

            case event.DELETE :
                this.closeActiveTab();
                break;

            case event.F4 : // this is actually the "S" key
                this.saveAll(); // handler
                break;

            // other cases...
        }
    }
});
于 2013-02-13T20:20:50.087 に答える