Hi,
I am trying to include the 'Add Below' functionality on a button click. Currently my code creates a task as a child of the selected task. Can you help me on below requirement .
-->When a button is click, it will create a task just below the selected cell as a sibling of the selected row.
Re: [REACT] Gantt Add Task Below using a button click
Posted: Wed May 17, 2023 6:45 pm
by sprabhu
Hi Tasnim,
Thanks for the reply. But the revised code is still not working.
gantt.selectedRecords.length. --> was giving error so I had to change it to gantt.up('gantt').selectedRecords.length
But then gantt.addTaskBelow is giving error : gantt.addTaskBelow is not a function
Below is the update code (We are using Gantt ver # 5.3.4)
It should help. If it doesn't help, Could you please upload a sample test case where we could reproduce the issue and debug it?
Re: [REACT] Gantt Add Task Below using a button click
Posted: Thu May 18, 2023 8:16 pm
by sprabhu
Hi Tasnim,
Now its working. Seems the issue with initializing the gantt. With your new code its working as expected.
Thanks for your help.
Re: [REACT] Gantt Add Task Below using a button click
Posted: Thu Jun 01, 2023 6:20 am
by sprabhu
Hi Tasnim,
Can we default some value to the newly inserted row, e.g. can we default duration to 1 after executing the gantt.addTaskBelow(gantt.selectedRecords[0])
Re: [REACT] Gantt Add Task Below using a button click
Re: [REACT] Gantt Add Task Below using a button click
Posted: Thu Jun 01, 2023 7:33 am
by sprabhu
Thanks for the quick reply. The above code works as expected but when i try to default the name as null, its not working.
Currently when we add a row the Name is defaulted as New task 2, New task 3.. and so on.