Dynamic event template in FullCalendar

前端 未结 5 962
北海茫月
北海茫月 2020-12-30 13:13

Is there any way to dynamically change event template in FullCalendar?

Update. What I want is to specify new event html (e. g. in eventRender callba

5条回答
  •  生来不讨喜
    2020-12-30 13:43

    The eventRender callback function can modify element, return a brand new DOM element that will be used for rendering instead, or it can return false, which will prevent the event from being rendered at all.

    http://fullcalendar.io/docs/event_rendering/eventRender/

    Example here: http://jsfiddle.net/3E8nk/506/

    $('#calendar').fullCalendar({
        header: {
            left: 'prev,next today',
            center: 'title',
            right: 'month,agendaWeek,agendaDay'
        },
        defaultDate: '2014-06-12',
        editable: true,
        eventRender: function(event, element, view) {
            return $('
    ' + event.title + '
    '); }, events: [ { title: 'All Day Event', start: '2014-06-01' }, { title: 'Long Event', start: '2014-06-07', end: '2014-06-10' }, { id: 999, title: 'Repeating Event', start: '2014-06-09T16:00:00' }, { id: 999, title: 'Repeating Event', start: '2014-06-16T16:00:00' }, { title: 'Meeting', start: '2014-06-12T10:30:00', end: '2014-06-12T12:30:00' }, { title: 'Lunch', start: '2014-06-12T12:00:00' }, { title: 'Birthday Party', start: '2014-06-13T07:00:00' }, { title: 'Click for Google', url: 'http://google.com/', start: '2014-06-28' }, ] });

提交回复
热议问题