Page 1 of 3

[REACT] Reset calendar events

Posted: Sat Nov 26, 2022 4:15 pm
by sasha573

Hi guys!
I'm obtaining tasks and calendars for the tasks via api and setting it on the gantt via setTasks[] and setCalendars[]. Evetything works fine during the first load.
However, if I'm loading additional tasks via api and resetting both tasks and calendar, I'm receiving the following error.

Capture2.PNG
Capture2.PNG (26.75 KiB) Viewed 1735 times

Does it mean that the calendars should be like a static config that could not be changed once the gantt is loaded?


Re: [REACT] Reset calendar events

Posted: Sun Nov 27, 2022 8:52 am
by alex.l

Hi sasha573
We have https://bryntum.com/products/gantt/docs/api/Gantt/model/ProjectModel#property-calendars property to set/get calendars.
Could you please post the code you used? We need to see the syntax, timing and be able to reproduce this to debugging.
Best of all attach a runnable test case, it allows us to help you faster.


Re: [REACT] Reset calendar events

Posted: Sun Nov 27, 2022 3:59 pm
by sasha573

Thanks Alex, I'll try to prepare runnable test case to share with you.
Just some more details on the issue. The error appears if only I'm ressetting the calendar with previously set calendar child.
Like, for the first load the calendar data is following:

[
  {
    "id": "0",
    "children": [
      {
        "id": "1",
	"name": "Calendar for machine:1",
        "intervals": [
          {
            "startDate": "2022-11-28 03:00:00",
            "endDate": "2022-11-28 05:00:00",
            "isWorking": false
          },
        ],
      }
    ]
  }
]

For the second updated upload, the calendar data includes child with the same id: "1":

[
  {
    "id": "0",
    "children": [
	{
        "id": "1",
	"name": "Calendar for machine:1",
        "intervals": [
          {
            "startDate": "2022-11-28 03:00:00",
            "endDate": "2022-11-28 05:00:00",
            "isWorking": false
          },
        ],
      },
      {
        "id": "2",
	"name": "Calendar for machine:2",
        "intervals": [
          {
            "startDate": "2022-11-29 03:00:00",
            "endDate": "2022-11-29 05:00:00",
            "isWorking": false
          },
        ],
      }
    ]
  }
]

It should be mentioned that the error doesn't appear if the calendar children ids are different during
various gantt updates.
Maybe there is the way to clear data in the gantt's calendar store before uploading updated data?


Re: [REACT] Reset calendar events

Posted: Mon Nov 28, 2022 11:31 am
by marcio

Hey sasha573,

We're looking forward to the project sample to debug your case and assist you.

Regarding the clear calendar data, you can try to use https://bryntum.com/products/gantt/docs/api/Gantt/model/ProjectModel#property-calendars and assign an empty array before assigning that new information, but I believe it won't solve your issue, we would need the code to inspect and find a proper solution to your case.


Re: [REACT] Reset calendar events

Posted: Mon Dec 05, 2022 3:35 pm
by sasha573

Hi guys!
I've made changes to inline-data sample in order to replicate the needed behavior (in attachment).
The calendar is assigned to each task child. Clicking on "Change Data" button simulates the api call to receive updated tasks and calendars.
The idea is that user could load task 1, then refresh data and load both task 1 and 2 with respective calendars. The non-working calendar intervals could change upon refresh.
Hovewer, from the attached sample, if we reset existing calendar intervals, only the initially loaded non-working intervals are displayed on gantt. Morover, at some point I'm catchin the following error:

inline-data.7z
(1.73 MiB) Downloaded 77 times

Re: [REACT] Reset calendar events

Posted: Tue Dec 06, 2022 5:55 am
by alex.l

Hi sasha573,

Thank you for the clear test case. I checked that and confirmed a bug. Here is a ticket to track the status https://github.com/bryntum/support/issues/5718


Re: [REACT] Reset calendar events

Posted: Tue Dec 06, 2022 10:11 am
by sasha573

Hi Alex!
Thanks! Could you please prioritize this issue somehow, as the display of non-working calendar events is very crucial for us.


Re: [REACT] Reset calendar events

Posted: Tue Dec 06, 2022 1:19 pm
by alex.l

Ok, I've informed our product management about your request.


Re: [REACT] Reset calendar events

Posted: Tue Dec 06, 2022 2:22 pm
by sasha573

Thanks Alex! Looking forward to their reply.


Re: [REACT] Reset calendar events

Posted: Wed Dec 07, 2022 5:47 am
by alex.l

It's assigned to 5.3.x milestone, so it will be fixed with one of nearest releases!