キーボート・ショートカットはapex.actions.addShortcutを呼び出して登録できます。
例として、Ctrl+Shift+Rを押すことで対話モード・レポートをリフレッシュするキーボード・ショートカットを登録してみます。
対話モード・レポートに静的IDとしてempを設定します。
ページ・プロパティのJavaScriptのページ・ロード時に実行に、以下のコードを記述します。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apex.actions.add( | |
[ | |
{ | |
name: "refresh-emp", | |
action: (event, element, args) => { | |
console.log(event.key, event.shiftKey, event.ctrlKey); | |
apex.region("emp").refresh(); | |
} | |
} | |
] | |
); | |
apex.actions.addShortcut("Ctrl+Shift+R", "refresh-emp"); |
これで完了です。
今回作成したアプリケーションのエクスポートを以下に置きました。
https://github.com/ujnak/apexapps/blob/master/exports/keyboard-shortcut.zip
Oracle APEXのアプリケーション作成の参考になれば幸いです。
完