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
- (required) enables/disables a hotkey inside the editor
Returning false from the event handler will disable hotkeys usage within the widget.
Example
<script>
import { Grid } from "@wx/svelte-grid";
import { getData } from "./common/data";
const { data, columns } = getData();
let api;
$: if (api) {
api.on("hotkey", ({ key, isInput }) => {
console.log(`key ${key} was pressed`);
});
}
</script>
<Grid bind:api {data} {columns} />
Related articles: