Our powerful JS Calendar component


Post by Vitaly Kroivets »

Hi everyone, I hope you are doing well.

First of all, I would appreciate for this library because this provides what we wanted.
While working with this library, I faced with some problem due to my experience.
I tried to reload the data once the calendar data has been changed but it doesn't seem not working.

My code snippets are as following:

const getCrudManager = () => {
    return {
      transport: {
        load: {
          url: `${process.env.REACT_APP_API_URL}api/v1/calendars`
        },
        sync: {
          url: `${process.env.REACT_APP_API_URL}api/v1/calendars`
        },
      },
      listeners: {
        sync: {
          fn() {
            //@ts-ignore
            Toast.show('Successfully saved.');
            //@ts-ignore
            calendar.current.calendarInstance.crudManager.load()
          }
        }
      }
    };
  };
  

The sample data is like this:

{
  "success": true,
  "resources": {
    "rows": [
      {
        "id": 1090656,
        "name": "John Doe",
        "eventColor": "yellow"
      }
    ]
  },
  "events": {
    "rows": [
      {
        "id": 19,
        "n_Project_FK": 1,
        "n_PersonInfoId_FK": 404343,
        "allDay": 0,
        "cls": null,
        "draggable": null,
        "duration": 1,
        "durationUnit": "hour",
        "exceptionDates": [],
        "name": "Roof Reparing",
        "recurrenceRule": null,
        "resizable": null,
        "resourceId": "1090656",
        "tasks": null,
        "startDate": "2020-10-01 05:45",
        "endDate": "2020-10-01 06:45",
        "d_AssignedDate": null,
        "n_CreatedUser": 1,
        "d_CreatedDate": "2020-09-30 19:44:10",
        "n_UpdatedUser": 1,
        "d_UpdatedDate": "2020-09-30 19:44:10",
        "n_Calendar_PK": 19
      },
      {
        "id": 20,
        "n_Project_FK": 1,
        "n_PersonInfoId_FK": 404343,
        "allDay": 0,
        "cls": null,
        "draggable": null,
        "duration": 1,
        "durationUnit": "hour",
        "exceptionDates": [],
        "name": "Cleaning",
        "recurrenceRule": null,
        "resizable": null,
        "resourceId": "1090656",
        "tasks": null,
        "startDate": "2020-09-30 06:15",
        "endDate": "2020-09-30 07:15",
        "d_AssignedDate": null,
        "n_CreatedUser": 1,
        "d_CreatedDate": "2020-09-30 19:46:19",
        "n_UpdatedUser": 1,
        "d_UpdatedDate": "2020-09-30 19:46:19",
        "n_Calendar_PK": 20
      }
    ]
  }
}

And this is error message that I'm getting: "TypeError: Cannot read property 'getOccurrencesForTimeSpan' of undefined"

It would be very appreciated if you can help me to solve this problem asap and move forward to next.

Best regards.

Vitaly


Post by mats »

Can you reproduce this on our basic demos with that data? Btw, it should not be needed to call load after a sync() since the sync call can return any updated data in its response.


Post Reply