Custom Event Content

Above the built in look & feel, the events can be customized in two ways:

  • Full event customization - The agenda handles the listing and ordering of the events, while the full styling falls into your hands. Explore this example for more details.
  • Content-only customization (like in this example) - When customizing only the content, the calendar handles the event start and end times, allDay and color rendering.

You will have to place and provide styling to the title field and any other custom fields you are using, like description, location, participants. You can add custom functionality, buttons and other custom components.

Pass a rendering function to the renderAgendaEventContent option. All original event fields along with computed fields like isMultiDay, lastDay can be used inside the function.

Download and try example

Demo

Loading the live demo

Preview in full screen

Add custom fields, descriptions, participants, and action buttons to agenda items — the agenda renders time and color automatically.

Code

mobiscroll.setOptions({
  locale:  ,
  theme: ' ',
  themeVariant: ' '
});

$(function () {
  var participants = {
    1: { name: 'Barry L.', img: 'https://img.mobiscroll.com/demos/m1.png' },
    2: { name: 'Hortense T.', img: 'https://img.mobiscroll.com/demos/f1.png' },
    3: { name: 'Carl H.', img: 'https://img.mobiscroll.com/demos/m2.png' },
  };
  var inst = $('#demo-event-content-template')
    .mobiscroll()
    .eventcalendar({
      actionableEvents: false,
      view: {
        calendar: { type: 'week' },
        agenda: { type: 'day' },
      },
      renderAgendaEventContent: function (data) {
        var participant = participants[data.original.participant];
        return (
          '<div>' +
          data.title +
          '</div>' +
          '<div class="mds-agenda-event-content mbsc-flex mbsc-align-items-center">' +
          '<img class="mds-agenda-event-avatar" alt="' +
          participant.name +
          '" src="' +
          participant.img +
          '"/>' +
          '<div class="mbsc-flex-1-1">' +
          participant.name +
          '</div>' +
          '<button mbsc-button class="mds-agenda-event-btn" data-color="secondary">Add participant</button>' +
          '</div>'
        );
      },
      onEventClick: function (args) {
        if (args.domEvent.target.classList.contains('mds-agenda-event-btn')) {
          mobiscroll.toast({
            message: args.event.title + ' clicked',
          });
        }
      },
    })
    .mobiscroll('getInst');

  $.getJSON('https://trial.mobiscroll.com/custom-events/?callback=?', function (events) {
    inst.setEvents(events);
  });
});
  

Duplicate Session

You have signed in on a different machine. To keep everything in sync, you have been signed out of this session.

If you need to invite team members, manage seats and accounts you can do it from the licenses page.

Duplicate Session

We noticed you are logged in on a different machine and have closed your old session.

If you need to invite team members, manage seats and accounts you can do it from the licenses page.