Multiple task addition with shortcut keys

Updated (WIP)

  • Select a task prior to create
    • Add a new child row after selecting a child task: Insert button which will add child task below it
    • Add a new WBS row after selecting a WBS: Shift+Insert button which will add WBS below it
  • Without selecting a task prior to create
    • Create a child task at the bottom of the list when Insert pressed without selecting any task
    • Create a WBS at the bottom of the list when Shift+Insert pressed without selecting any task
  • Also remove the parent creation when selecting a child task while adding
  • Using indent and outdent, we shall create parent and child task
  • Don’t disable the Create Task icon when task is in rename mode, similar to primavera

Hello,
The similar question is answered here:


Select a task prior to create
Add a new child row after selecting a child task: Insert button which will add child task below it

You can use the addShortcut method to add a shortcut and attach it to the "taskRow" or "taskCell" scopes:
https://docs.dhtmlx.com/gantt/desktop__keyboard_navigation.html#:~:text=the%20whole%20Gantt.-,Adding%20a%20shortcut,-To%20create%20a

Then you can obtain the ID of the task row with the locate method:
https://docs.dhtmlx.com/gantt/api__gantt_locate.html

After that, you can use the createTask method and specify the task ID as the second parameter and 0 as the third parameter:
https://docs.dhtmlx.com/gantt/api__gantt_createtask.html

Here is an example in the snippet:
https://snippet.dhtmlx.com/3ea79kve


Without selecting a task prior to create
Create a child task at the bottom of the list when Insert pressed without selecting any task

You can use the addShortcut method and attach it to the "gantt" scope:
https://docs.dhtmlx.com/gantt/desktop__keyboard_navigation.html#:~:text=the%20whole%20Gantt.-,Adding%20a%20shortcut,-To%20create%20a

After that, you can use the createTask method to add a task to the bottom:
https://docs.dhtmlx.com/gantt/api__gantt_createtask.html

Please note that to make it work, you need to place the focus to the Grid. You can do that if you click on the grid header cell or start adding a new task and click on the “Cancel” button.

Here is an example in the snippet:
https://snippet.dhtmlx.com/fn9av667


Select a task prior to create
Add a new WBS row after selecting a WBS: Shift+Insert button which will add WBS below it
Without selecting a task prior to create
Create a WBS at the bottom of the list when Shift+Insert pressed without selecting any task

Gantt doesn’t have WBS tasks/rows. You need to implement that feature manually by using the Gantt API and Javascript.
You can create a custom task type as described in the following article:
https://docs.dhtmlx.com/gantt/desktop__task_types.html#creatingacustomtype
You will need to manually add the styles and the logic you need.

After that, you can use the same approach as described above for regular tasks.

If you want us to implement the WBS tasks for you, you can contact the Sales team:
info@dhtmlx.com


Also remove the parent creation when selecting a child task while adding

It is not clear what you mean. Please describe your question in more detail.


Using indent and outdent, we shall create parent and child task

Gant has the Shift+Left and Shift+Right to indent and outdent tasks when the keyboard navigation is used:
https://docs.dhtmlx.com/gantt/desktop__keyboard_navigation.html#:~:text=Shift%2BLeft/Right%20-%20indent/outdent%20task

So, when you use it, a task above the selected task becomes the parent task when you indent the selected task. Or it becomes a regular task if you outdent the selected task, and there are no other child tasks for the task above.

If you need something different, please describe your requirement in more detail.


Don’t disable the Create Task icon when task is in rename mode, similar to primavera

By default, the “+” icon is not disabled. If you do that, you already did something with the Gantt configuration. And to change how it works, I need to know which code you applied. You can add your configuration to the following snippet and make sure that the issue is reproduced there:

Then, click on the Save button and send me the link.
Or send me a ready demo with all the necessary JavaScript and CSS files so that I can reproduce the issue locally.

1 Like