Get the id of the task whose add button is select


#1

Hi,

How can i get the id of the task whose add button is select?


It doesn’t work with gantt.getSelectedId()
Any help would be appreciated!
Sara.


#2

Hello Sara,
gantt.getSelectedId() works only if you connect the “Multiselect” extension:
https://docs.dhtmlx.com/gantt/desktop__multiselection.html
You can get the ID of the selected task by using onBeforeTaskSelected event handler:
https://docs.dhtmlx.com/gantt/api__gantt_onbeforetaskselected_event.html
Here is an example:
https://snippet.dhtmlx.com/944f26498

If you want to apply a custom function after clicking on the “Add” button, you need to add a custom “add” column and specify the function in the template. Here is another example:
https://snippet.dhtmlx.com/c37857627


#3

Thank you very much! it works!