Our state of the art Gantt chart


Post by jhughesoneplan »

I am having an issue where added tasks don't sync properly. It syncs and then returns data back. But then changes show a new task has been added with the updated id.

{
    "added": [
        {
            "parentIndex": 3,
            "StartDate": "2022-10-31 08:00:00",
            "EndDate": "2022-10-31 17:00:00",
            "Duration": 1,
            "durationUnit": "day",
            "cls": "",
            "iconCls": "empty",
            "style": "background-color: #undefined",
            "Name": "j",
            "effortUnit": "hour",
            "effortDriven": true,
            "SchedulingMode": "FixedDuration",
            "baselines": [],
            "parentId": "71b60806-f2ad-4310-8fcf-7eedd286ec11",
            "Milestone": false,
            "WBS": "4",
            "taskorder": 4,
            "$PhantomId": "_generatedn_a1cf40d4-a40f-400c-a47e-ba43b74e5dcc"
        }
    ]
}

that is in the changes. Notice the phantom id

tasks:{
  "rows": [
    {
      "parentIndex": 3,
      "StartDate": "2022-10-31 08:00:00",
      "EndDate": "2022-10-31 17:00:00",
      "Duration": 1,
      "durationUnit": "day",
      "cls": "",
      "Name": "j",
      "direction": "Forward",
      "ignoreResourceCalendar": null,
      "leaf": true,
      "Id": "0d546284-494c-462e-aca5-7bdd47299d90",
      "$PhantomId": "_generatedn_a1cf40d4-a40f-400c-a47e-ba43b74e5dcc"
    }
  ],
  "removed": []
}

This is what is returned. It then sets the task to the new id. But now in the changes object we have what appears to be a new added task with that new id

[
    {
        "parentIndex": 3,
        "StartDate": "2022-10-31 08:00:00",
        "EndDate": "2022-10-31 17:00:00",
        "Duration": 1,
        "durationUnit": "day",
        "cls": "",
        "iconCls": "empty",
        "style": "background-color: #undefined",
        "Name": "j",
        "CalendarId": null,
        "direction": "Forward",
        "$PhantomId": "0d546284-494c-462e-aca5-7bdd47299d90"
    }
]

This happened after upgrading to 5.2.1. Additionally. project.clearChanges() wont even clear out that added task


Post by marcio »

Hey jhughesoneplan,

Are you able to set up a sample project with your configuration and some data, with that behavior that you described? We'll need more context regarding configuration to check what could be causing this.

Best regards,
Márcio


Post by jhughesoneplan »

go here: https://oneplanqa.azurewebsites.net/home/repro504

Add an item at the bottom using the text box. Check the BaseGridApp.Controls.Gantt.project.changes object
see that there is an item with a phantom id
press save in top left
now check BaseGridApp.Controls.Gantt.project.changes
the added task is still there but the Id has changed.
you can also try BaseGridApp.Controls.Gantt.project.clearChanges() which doesnt clear the tasks.


Post by marcio »

So, the behavior related to BaseGridApp.Controls.Gantt.project.changes is correct, as the phantomId has that generatedId value because it wasn't persisted yet (and that's exactly what phantomId stands for). After you save it and persisted the record with a proper id, the record is updated to have the right id provided by the backend. And as it is still added from the default state of the Gantt, that's why it remains in the BaseGridApp.Controls.Gantt.project.changes.

About that clearChanges call, you'll see in the definition of the method (https://www.bryntum.com/docs/gantt/api/Core/data/Model#function-clearChanges) that:

Clear stored changes, used on commit. Does not revert changes.

So, after you persisted that record with a proper id, the right behavior is to maintain that record in that object, as it doesn't revert changes that were already committed.

What's the expected behavior from your side??

Best regards,
Márcio


Post by jhughesoneplan »

Previous version if I have something in the changes and its sent to the server. It then responds with the new task id. It is removed from changes as it has been successfully sent to server. At that point there is no reason for it to be in the added object as it has been added and confirmed. Once the data is synced the changes should certainly be empty. Why would this functionality change?

Also why doesnt clearchanges remove it? There is certainly something going on here.


Post by marcio »

Yeah, that makes sense, I wrote a ticket to investigate that behavior more deeply, if you're able to, please share the source code from that example for us to check it. https://github.com/bryntum/support/issues/5510

Best regards,
Márcio


Post by jhughesoneplan »

and a note the clearchanges works prior to sync to the server. So if you add an item and then clear changes it works. Soon as you sync it no longer goes away. So I assume its related to that.


Post by marcio »

Added a note there, thanks!

Best regards,
Márcio


Post by jhughesoneplan »

Hello,
Has there been any resolution to this. I am trying to get upgraded to 5.2.1 but this is preventing that


Post by tasnim »

Hi,
We've assigned one of our developers to it and set milestones to 5.2.x. It might be out in the nearest release. But can't give you any date when it's going to be fixed. Please subscribe to the ticket so it will notify you when it fixes.

Good Luck :),
Tasnim


Post Reply