Our state of the art Gantt chart


Post by Maxim Gorkovsky »

I can see this problem in our advanced demo.
In fact, after load you would see changes in the task store immediately. I opened ticket about this: https://app.assembla.com/spaces/bryntum/tickets/9390-task-store-in-angular-advanced-demo-has-changes-after-load/details

Workarond would be to commit store after load:
project.load({}).then(() => {
    project.taskStore.commit();
});
When you apply this and add record, you would still see changes on the project model though. But now it would only report change in effort, which is expected. Project is similar to task and shares lot of fields, like start/end/duration etc. But that change doesn't appear in the sync request, which is probably an issue. I opened ticket about this too: https://app.assembla.com/spaces/bryntum/tickets/9391-when-adding-record-to-project-root-project-appears-changed-but-is-missing-fr/details

Thank you for report.

Post by jandresampaio »

That solution is not good for us because we're providing our eventsData as inline properties. When loading project like that it will return us an http error (we're not using CRUD manager)...

Our code:
      
      const project = new ProjectModel({
            id: this.projectId,
            eventsData: tasks,
            dependenciesData: dependencies,
        })
The error when using that load({}) :
Error_project_load.PNG
Error_project_load.PNG (188.91 KiB) Viewed 1333 times

Post by saki »

The changes in the task store in the example are caused by project on load handler that updates Start Date field in the toolbar. This is the code:
        project.on('load', ({source}) => {
            panel['tbar'].widgetMap.startDateField.value = source.startDate;
        });
Remove this listener and the taskStore will be unchanged after the project loads.

Post by jandresampaio »

I'm not using my toolbar in my example. Can you explain how to load without using CrudManager?

Post by sergey.maltsev »

Hi, jandresampaio!

You received "Unexpected token..." error because you didn't properly configured project's transport option, so loading caused this fail.

No need to call project.load() if you use tasks in Gantt config because they will be loaded automatically.

Also you could add tasks in code like this, also no need to to call project.load() .
gantt.taskStore.add(
    {
        'id'        : 1000,
        'name'      : 'Launch SaaS Product',
        'startDate' : '2019-01-02',
        'endDate'   : '2019-01-03'
    }
);

Post by jandresampaio »

Hi Sergey,

That does not address my original issue.
As Maxim said in a previous post
I can see this problem in our advanced demo.
In fact, after load you would see changes in the task store immediately. I opened ticket about this:
New
#9390: Task store in angular advanced demo has changes after load

As workaround, it was provided that load code...which we don't use since we're using inline data.
My question is what's the workaround, in our case?

Thank you.

Post by sergey.maltsev »

Hi, jandresampaio!

Our advanced demo uses crudmanager to load data, thus it have the problem with the CRUD changeset.

If you use inline data and still have the same problem so don't use project.load() and as a workaround suggested by Maxim just call
project.taskStore.commit();

Post Reply