Our state of the art Gantt chart


Post by hien.nguyen »

Hi team,

I can open edit task popup by using code

gantt.editTask(taskRecord)

But in my case, I've custom button "Add new task" and I want trigger action on this button to open new task popup. Do we've similar method same as edit task? I tried to use

gantt.addTask()

but failed.

Thanks.

Best regards.


Post by tasnim »

Could you please share the code of that button? What does it look like? Is it on the tbar?


Post by hien.nguyen »

Hi Tasnim,

Code is empty, I just have new custom button outside chart like below

1.png
1.png (38.18 KiB) Viewed 1567 times

Best regards.


Post by tasnim »

Hi,

Inside your button click fn use this code

const records = gantt.selectedRecords;
if (records.length > 0) {
    gantt.editTask(records[0]);
} else {
    Toast.show('No selected task found');
}

Docs
https://bryntum.com/products/gantt/docs/api/Gantt/view/Gantt#property-selectedRecords
https://bryntum.com/products/gantt/docs/api/Gantt/feature/TaskEdit#function-editTask
https://bryntum.com/products/gantt/docs/api/Core/widget/Toast

Attachments
chrome_d5J98w1nY7.gif
chrome_d5J98w1nY7.gif (1.41 MiB) Viewed 1563 times

Post by hien.nguyen »

Hi tasnim,

it's about

edit task

We not have popup for

add new task

?

Best regards.


Post by tasnim »

Then you could listen for this event https://bryntum.com/products/gantt/docs/api/Gantt/data/TaskStore#event-add to open the task edit after adding a new event

Inside that event use that gantt.editTask(record)

gantt.taskStore.on('add', (event) => {
    gantt.editTask(event.records[0]);
})
Attachments
chrome_qFcyCzGeBJ.gif
chrome_qFcyCzGeBJ.gif (1.04 MiB) Viewed 1560 times

Post by hien.nguyen »

It's ok for case add new, but for other cases (move tasks) << after moving, edit popup task appear. Do we have any option to cash only for case

add new task/subtask/milestone

?

Best regards.


Post by alex.l »

Do you have task editor dialog appeared when you move task after you added this code?

gantt.taskStore.on('add', (event) => {
    gantt.editTask(event.records[0]);
})

All the best,
Alex


Post by hien.nguyen »

Yes, I've task editor dialog appeared.

Best regards.


Post by tasnim »

Hi,

It's ok for case add new, but for other cases (move tasks) << after moving, edit popup task appear. Do we have any option to cash only for case

Could you please elaborate a bit? I'm not sure what exactly you're trying to achieve


Post Reply