vkurko / calendar

Full-sized drag & drop JavaScript event calendar with resource & timeline views
https://vkurko.github.io/calendar/
MIT License
1.07k stars 92 forks source link

Event background color defined from an ressource #295

Closed Daviruss1969 closed 1 week ago

Daviruss1969 commented 2 weeks ago

Hello,

I have an issue with setting the background color of an event according to the resources, I might be doing something wrong but I read the documentation and my code seems logic.

In the timeline view, the resources are correctly set with the event.

Settings the color directly in the event or globally works fine.

Here's my options :

  calendar = new Calendar({
    target: canva.value,
    props: {
      plugins: [TimeGrid, Interaction, List, RessourceTimeline],
      options: {
        view: 'timeGridWeek',
        nowIndicator: true,
        eventStartEditable: false,
        eventDurationEditable: false,
        dateClick: dateClickCallback,
        eventClick: eventClickCallback,
        headerToolbar: {
          start: 'today prev,next',
          center: 'title',
          end: 'timeGridDay,timeGridWeek,listWeek,resourceTimelineWeek'
        },
        events: [
          {
            title: 'Test 1',
            start: '2024-07-10T08:00:00',
            end: '2024-07-10T10:00:00',
            resourceIds: [0]
          },
          { 
            title: 'Test 2',
            start: '2024-07-10T09:30:00',
            end: '2024-07-10T13:50:00',
            resourceIds: [1]
          },
          {
            title: 'Test 3',
            start: '2024-07-11T15:15:00',
            end: '2024-07-11T17:45:00',
            resourceIds: [0, 1]
          }
        ],
        resources: [
          {
            id: 0,
            title: 'Lukas',
            eventBackgroundColor: 'red'
          },
          {
            id: 1,
            title: 'Jhon',
            eventBackgroundColor: 'green'
          }
        ]
      }
    }
  })

And the results :

image

Thanks for your work !

Daviruss1969 commented 2 weeks ago

I have an update, it works now, I added the @event-calendar/resource-time-grid plugin and I got the colors. I leave this, I don't know if it's an issue or not.

vkurko commented 2 weeks ago

I confirm that the problem exists. This should work without having to use @event-calendar/resource-time-grid. I will fix this in a future version. Thank you for reporting.

vkurko commented 2 weeks ago

The problem should be fixed in Event Calendar v3.2.0. Please check.

vkurko commented 1 week ago

I hope I can close this issue.