Our state of the art Gantt chart


Post by daniel.piret »

Hello,

In the previous version (ExtJS) we had this call to retrieve the progress of the project:

gantt.getViewModel().get('taskStore').getRootNode().getPercentDone()

I'm trying to port this to the new code and using this:

gantt.taskStore.rootNode

but it does not seem to have a percentDone anymore, I've checked the ProjectModel and it does not include the PercentDoneMixin, is there any way to retrieve the project progress based on the tasks?

Thanks


Post by pmiklashevich »

Hello!

It seems you're right. There is no public way to do this. We will discuss the possibility to create a field or a function to get the value out of the box. Meanwhile you can apply some manual calculation. Just need to calc average of percentDone field of top nodes. For example:

const topNodes = gantt.taskStore.rootNode.children;
const projectPercentDone = topNodes.length > 0 ? topNodes.reduce((acc, task) => acc + task.percentDone, 0) / topNodes.length : 100; // fallback to any if no tasks

https://github.com/bryntum/support/issues/1834

Best,
Pavel

Pavlo Miklashevych
Sr. Frontend Developer


Post by daniel.piret »

Tested and working, thanks


Post Reply