Skip to main content

hotkey

Description

Fires when applying a hotkey

Usage

hotkey:({
key: string,
event: object,
eventSource?: string
}) => 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
  • eventSource - (optional) the source of the event call: it can be "grid" or "chart"; it`s required for "arrowup"/"arrowdown"

Example

<script>
import { Gantt } from "wx-svelte-gantt";
import { getData } from "./common/data";

const data = getData();

function init(api){
api.on("hotkey", ev => console.log(ev.key));
}
</script>

<Gantt {init} tasks={data.tasks} />

Related articles: