2

Using Fullcalendar v5.

I am trying to integrate the horizontal timeline resource, where we have an employee and a customer. If an employee has to help a customer I want to show the same event for the employee resource and customer resource. The event looks like this:

{
    "title": "THIS IS NOT A TITLE",
    "start": "2021-06-29T08:30:00+02:00",
    "end": "2021-06-29T09:30:00+02:00",
    "id": "42",
    "resourceIds" : [ "A" , "B" ],
    "extendedProps": {
        "customer": "ABECAZEN Lucette ",
        "employee": "Kevin"
    }
}

I use the eventContent hook (https://fullcalendar.io/docs/event-render-hooks) to try to change the title of the event, so that when I render the event in the resource of the employee, it will show the name of the customer, and vice versa if the event is rendered in the resource of the customer it will show the name of the employee. The hook is called for each time the event is rendered for each resource (so if I have 1 event and 2 resources, the hook is called twice). However I am not able to find a way to detect for which resource the event is rendered, so I can change the title.

What I would like to achieve is the following line of code, but I am not able to find out the "resourceId".

eventContent: function(arg) {
        if(resourceId === "A") {
            var name = arg.event.extendedProps.customer;
        } else if ( resourceId === "B" ) {
            var name = arg.event.extendedProps.employee;
        }
        return name;
    }

Kind regards

Andries

ADyson
  • 57,178
  • 14
  • 51
  • 63
Andries Heylen
  • 363
  • 1
  • 2
  • 12

0 Answers0