Add new task using keyboard shortcuts

use Insert button to add child task and Shift + Insert button to add parent task.

i want to have keyboard shortcuts to add new child and parent tasks

Hello,

To add keyboard shortcuts for creating new child and parent tasks, you can use the addShortcut method. This method allows you to define custom keyboard shortcuts and associate them with specific actions. Here’s an example of how you can achieve this:

 gantt.plugins({
    keyboard_navigation: true
});

gantt.config.keyboard_navigation = true;
gantt.config.keyboard_navigation_cells = true;

...

gantt.addShortcut("alt+ctrl+enter", () => {
    const parentTaskId = gantt.addTask(
        { text: "Parent Task" },
        gantt.config.root_id
    );

    gantt.addTask(
        { text: "Child Task 1" },
        parentTaskId
    );
});

Please see an example: DHTMLX Snippet Tool

1 Like