Skip to main content

hotkey

Description

Fires when applying a hotkey in the table

Usage

"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 event
  • isInput - (required) enables/disables a hotkey inside the editor

Returning false from the event handler will disable hotkeys usage within the widget.

Example

export default function App() {
const api = useRef(null);

useEffect(() => {
if (api.current) {
api.current.on("hotkey", ({ key, isInput }) => {
console.log(`key ${key} was pressed`);
});
}
}, [api]);

return <Grid api={api} data={data} columns={columns} />;
}
import { Grid } from "wx-react-grid";
import { getData } from "./common/data";

const { data, columns } = getData();

Related articles: