如何自定义键盘快捷键 ag-grid?

时间:2021-05-05 12:07:53

标签: javascript keyboard-shortcuts customization ag-grid ctrl

如何自定义键盘快捷键,例如CTRL+S = 保存、CTRL+S = 启用编辑 ag-grid 表格。

$(document).keydown(function (e) {

var key = undefined;
var possible = [e.key, e.keyIdentifier, e.keyCode, e.which];

while (key === undefined && possible.length > 0) {
    key = possible.pop();
}
if (key && (e.which === 83) && (e.ctrlKey || e.metaKey) && !(e.altKey)) {
    params.api.stopEditing(false);
} else if (key && (key == '69') && (e.ctrlKey || e.metaKey) && !(e.altKey)) {
    params.api.stopEditing(true);
}
return true;

});

0 个答案:

没有答案
相关问题