eventRender disappears in fullcalendar v5
Asked Answered
T

3

9
Version : Fullcalendar-Scheduler v5 beta2

I tried eventRender like below in chrome:

document.addEventListener('DOMContentLoaded', function() {
    var calendarEl = document.getElementById('planningMix');
    var planningMix = $(calendarEl);
    var calendar = new FullCalendar.Calendar(calendarEl, {
        //...
        eventRender: function(info) {
            debugger
          },
        events: function(d, successCallback, failureCallback) {
           //...
        }
    });

    calendar.render();
});

When I run this code, "debugger" didn't fired. eventRender has became another name in V5 ?

Trejo answered 28/4, 2020 at 13:23 Comment(0)
B
6

those who were going to upgrade from V4 to V5, check this document upgrading-from-v4, there were many changes which we need to consider while upgrading.

Example of EventContent

eventContent: function (arg) {

            var event = arg.event;
            
            var customHtml = '';
            
            customHtml += "<span class='r10 font-xxs font-bold' style='overflow: hidden;'>" + event.title + "</span>";
            
            customHtml += "<span class='r10 highlighted-badge font-xxs font-bold'>" + event.extendedProps.age + text + "</span>";
                          

            return { html: customHtml }
        }
Blackstone answered 30/12, 2021 at 11:48 Comment(0)
F
1

You can use this :

eventClick: function (info) {
            showdata(info.event.id);
         }

I used v3 and upgrading to v5 and still working.

Farra answered 9/3, 2022 at 9:20 Comment(0)
B
0

I also got the same problem when going to get events from back-end, finally found a solution.

'eventSources'

eventSources: {
              url: 'test/getEvents',
              type: 'get',
              error: function() {
                alert('there was an error while fetching events!');
              }
           }
  

PHP backend array structure is like this : Example

$events = [
      [
        'title'          => 'All Day Event',
        'start'          =>  '2022-07-26T00:00:00+05:30',
        'backgroundColor'=>  '#f56954', //red
        'borderColor'    =>  '#f56954', //red
        'allDay'         =>  true
      ],
      [
        'title'          => 'All Day Event',
        'start'          =>  '2022-07-28T00:00:00+05:30',
        'backgroundColor'=>  '#f56954', //red
        'borderColor'    =>  '#f56954', //red
        'allDay'         =>  true
      ]
   ];
   echo json_encode($events);
Barnie answered 2/7, 2022 at 4:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.