Premium support for our pure JavaScript UI components


Post by vincenzo.menzella »

Hi everyone,

I need to wait until the tasks I’ve just added to the TaskStore have their references fully updated.

I noticed that both the DependencyStore and EventStore have an addAsync() method, which allows waiting for this kind of asynchronous processing.
However, the TaskStore doesn’t seem to provide an equivalent addAsync() method.

What’s the recommended way to ensure that the newly added tasks are fully initialized and all references are up to date before proceeding with further operations?

Thanks in advance for your help!


Post by tasnim »

Hi there,

Use the Project commit API to wait for the engine to finish after adding tasks. TaskStore doesn’t have addAsync, so do the add() then await project.commitAsync(). Example:

// add tasks
const records = gantt.project.taskStore.add([{ id: 101, name: 'New task', startDate: '2025-11-12', duration: 1 }]);
// ensure scheduling / references are updated
await gantt.project.commitAsync();

Docs
https://bryntum.com/products/gantt/docs/api/Gantt/model/ProjectModel#function-commitAsync

Best regards,
Tasnim

How to ask for help? Please read our Support Policy


Post Reply