Our state of the art Gantt chart


Post by yuriv »

Hello,

According to our project requirements I need to implement next scenario:

  • On first data request we get just tasks tree skeleton with ids and names

  • As soon as skeleton is loaded we make the second request to get visible tasks detailed data and enrich existing data with it

  • On scroll/resize/expand we make same additional requests

Also I want to leverage Bryntum ProjectCrudManager sync feature. But if sync is used, on data enrichment it makes unnecessary update request. To make things work I need to somehow disable sync calls when I manually enrich data as described above.

I found a sort of working solution, but it doesn't look conventional and it's performance is unacceptably low. Is there better way to implement this?

    async enrichTasks() {
        const taskIdsToEnrich = this.getTaskIdsToEnrich();
        if (!taskIdsToEnrich.length) {
            return;
        }

        const data = await getTasksDetails.call(taskIdsToEnrich);
        const { taskStore, project } = this;

        data.forEach((taskData) => {
            const record = taskStore.getById(taskData.id) as TaskModel;
            if (record) {
                record.setMultiple(taskData);
                project.propagate();
                record.clearChanges();
            }
        });

        project.propagate();
    }

Post by yuriv »

Update: just tried record.setMultiple without any propagations and with only 3 tasks (12 fields in each) to update it leads to terrible freezes and memory load.

        data.forEach((taskData) => {
            const record = taskStore.getById(taskData.id) as TaskModel;
            if (record) {
                record.setMultiple(taskData);
            }
        });

Post by fabio.mazza »

Hi yuriv,

To disable autoSync just set it to false using the crudManager config https://www.bryntum.com/docs/gantt/#Scheduler/crud/AbstractCrudManagerMixin#config-autoSync

...
new ProjectModel({
    autoSync : false,
    ...
});
...

The setMultiple function is internal so keep in mind using it can be changed or be unavailable on future. Check on doc all available methods to use: https://www.bryntum.com/docs/gantt/

If you have any additional question, please let us know.

Best regards,
Fabio


Post by yuriv »

Thanks Fabio,

To disable autoSync just set it to false

Sure, but I want to use sync to propagate user changes. So disabling it is not a solution. Do I have other options?

The setMultiple function is internal

Can you suggest more conventional solution?


Post by fabio.mazza »

yuriv, I have created and issue to implements that feature, you can follow by this link: https://github.com/bryntum/support/issues/1853

You can also use method https://bryntum.com/docs/scheduler/#Core/data/Model#function-set (instead of setMultiple) passing the flag silent as true to not call the sync.

Best regards,
Fabio


Post by yuriv »

Are you sure that such a suspension will be enough? As I understand, we also have to clear changes on data store records. If we don't do this, synchronization will fire as soon as we turn on autoSync back.


Post by fabio.mazza »

Best regards,
Fabio


Post by yuriv »

So you confirm that I use right method actually, that's cool.

Problem with performance finally narrowed down to using React cell renderers + having Chrome devtools open. I will create separate topic on this with test case shortly.


Post by saki »

This issue has been resolved, see your last threads.


Post Reply