hotkey
Description
Fires when applying a hotkey in the tableUsage
"hotkey": ({
key: string,
event: any,
isInput?: boolean
}) => boolean | void;
Parameters
The callback of the action takes an object with the following parameters:
key- (required) a hotkey name, for the combination of hotkeys use "+", e.g. "shift+arrowup"event- (required) keyboard eventisInput- (optional) enables/disables a hotkey inside the editor
Returning false from the event handler will disable hotkeys usage within the widget.
Example
import { Grid } from "@svar-ui/react-grid";
import { getData } from "./common/data";
export default function Example() {
const { data, columns } = getData();
function init(api) {
api.on("hotkey", ({ key, isInput }) => {
console.log(`key ${key} was pressed`);
});
}
return <Grid init={init} data={data} columns={columns} />;
}
Related articles: