FullCalendar events are missing 'Editable' field?

Viewed 72

Let's say I have a basic setup of events like the following :

  initialEvents: EventInput[] = [
    {
      title: 'Event 0',
      start: '2021-02-22T10:00:00',
      end: '2021-02-22T12:00:00',
      editable: false
    },
    {
      title: 'Event 1',
      start: TODAY_STR + 'T12:00:00',
      end: TODAY_STR + 'T16:00:00',
    },
    {
      title: 'Event 2',
      start: '2021-02-24T09:00:00',
      end: '2021-02-26T12:00:00',
    }
  ]

Using this in my calendar options :

...
initialView: 'timeGridWeek',
initialEvents: this.initialEvents,
eventClick: this.handleEventClick.bind(this),
...

And having this method :

  handleEventClick(clickInfo: EventClickArg): void {
    console.log(clickInfo.event);
    if (confirm(`Are you sure you want to delete the event '${clickInfo.event.title}'`)) {
      clickInfo.event.remove();
    }
  }

It seems the EventApi event fom my clickInfo works almost fine, it contains almost all the properties stated in the documentation there : https://fullcalendar.io/docs/event-object

Except it's missing the properties editable and resourceEditable.

They are also missing in the EventApi class found in the ...\node_modules\@fullcalendar\common\main.d.ts file.

So how can I access the editable property of my event when I click it ?

(I'm using the v5.5.0 with angular)

1 Answers

OK, so it turns out, events don't have an editable property.

This is just a convenience setter that sets both startEditable and durationEditable.

These are the 2 properties to use in order to get the editable status of the event.

Related