22

I'm using the pretty fullCalendar jQuery plugin.

I'd like to be able to have a title AND a detail on each event as in the screenshot below:

Here the details are the participants for each session. (overflow hidden on the detail)

vmg
  • 4,176
  • 2
  • 20
  • 33
Pierre de LESPINAY
  • 44,700
  • 57
  • 210
  • 307

4 Answers4

50

See This (Eureka's Answer)

eventRender: function(event, element)
{ 
    element.find('.fc-event-title').append("<br/>" + event.description); 
}
Community
  • 1
  • 1
orolo
  • 3,951
  • 2
  • 30
  • 30
6

Based on fullcalendar documentation

V5

If you want to set the title use eventDidMount instead of eventRender

eventDidMount:function(info){
   info.el.title="---- YOUR TEXT----"
}
Abolfazl Roshanzamir
  • 12,730
  • 5
  • 63
  • 79
  • Note that doesn't change the displayed text (at least in "list" views), I use `mountArg.el.children[2].innerHTML = "Custom title with HTML Tag"` to di this. Just use the correct children which may be different from my example based on view type. – Skunka Jan 31 '22 at 09:06
  • `info.el.title` not work in v6, use `info.event.setProp("title", "");` instead – frank May 30 '23 at 03:29
  • You are correct with the `eventDidMount` callback, although the way to access the data is via the `extendedProps` key as per example below. – itsgus.dev Jun 09 '23 at 01:22
1

Currently (V6) a solution is to use the eventDidMount callback and access the extendedProps data:

eventDidMount: function(info) {
  var eventElement = info.el;
  let descriptionElement = document.createElement('div');
  descriptionElement.innerHTML = info.event.extendedProps.description;
  eventElement.appendChild(descriptionElement);
}

Style your element to display as needed.

itsgus.dev
  • 87
  • 5
0

For anybody having this issue in Angular 8:

eventRender: function(event, element)
{ 
    (element as Element).querySelector('span.fc-title').append("<br/>" + event.description); 
}