search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Update Scheduler Resources/Events

Asked by Thaddeus
1 year ago.

An initial scheduler is generated using default data no problem. After user interaction with checkboxes outside the scheduler there is a need to refetch the resources/events to refresh the scheduler. When attempting to assign the new data to this.dp.resources the following message is produced:

message: "Cannot set properties of undefined (setting 'resources')"
stack: "TypeError: Cannot set properties of underfined"

The same message is produced when trying to hardcode in the values with the given example in article: https://api.daypilot.org/daypilot-scheduler-update/

Code snippet

  async updateCalendar() {
    let updatedResources = await this.getRefreshedResources();
    this.resources = unwrapResource(updatedResources);
    let updatedEvents = await this.getRefreshedEvents();
    this.events = unwrapEvent(updatedEvents);
    //this.dp.resources = this.resources;  <---This line failes
    this.dp.resources = [ {name: 'Core', id: 'a1x3J000000lTDQQA2'},{name: 'Cafe', id: 'a1x3J000000lTDRQA2'},];  //  <--This line also failes
    this.dp.events.list = this.events;  //<--This line will also fail if the resource line is commented out with the same error
    this.dp.update();
  }

Do the resources/events need to be cleared before re-initializing?

Answer posted by Thaddeus
1 year ago.

Please disregard, this has been solved. The scheduler was not initialize in the correct spot to make it globally available aboutside the rendered callback.

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.