Angular Fullcalendar Resource label with DOM Events are only executed once after running getApi() associated methods

405 Views Asked by At

I'm currently rendering some resources and events inside my Angular + FullCalendar app.

I have the next resourceLabelDidMount() method in the calendarOptions:

resourceLabelDidMount: (info) => {
      if (!info.el.classList.contains('section_item')) {
        // Activity Info
        let activityInfoElement = info.el.querySelector('.activity-info');
        activityInfoElement.addEventListener('click', () => {
          this.showActivityDescription(info);
        });

        // Event Creation / Management
        let clickedElement = info.el.querySelector('.planificator');
        clickedElement.addEventListener('click', () => {
          this.showDialog(info);
        })
      }
    },

The problem is when I run the next code inside the showDialog() method (in this method I need to create one Event associated with this resource, and maybe any resource property must be changed - priority as example), I cannot execute the 'click' event, then the click is only executed once.

let resource = this.calendarRef.getApi().getResourceById(res.activity.id)
resource.setExtendedProp('priority', 1);

The resource is updated after I execute the previous code, but I'm not able again to run the click event associated with the resourceLabelDidMount() method and the addEventListener executed inside that method.

0

There are 0 best solutions below