Task Checklist in Events

When there are subtasks related to work orders, it may be necessary to display them in the context of work order (or event). Subtasks can be rendered as a list with the possibility of adding new items using the Prompt or more sophisticated modals even. The height of resources will dynamically increase depending on the height of the events/length of lists.

To allow dynamic changes in heights according to the length of subtask lists, eventHeight: 'variable' is used, along with custom event content rendering to maintain the appropriate theme styles.

Download and try example

Demo

Loading the live demo

Preview in full screen

Render a task checklist inside each Timeline event card — row heights expand as the list grows, and a popup let users add new subtasks.

Code

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

var inst = mobiscroll.eventcalendar('#demo-tasks-calendar', {
  view: {
    timeline: {
      type: 'week',
      eventHeight: 'variable',
      eventDisplay: 'fill',
    },
  },
  dragToCreate: true,
  clickToCreate: true,
  dragToMove: true,
  dragToResize: true,
  extendDefaultEvent: function () {
    return {
      title: 'New Event',
      tasks: ['Default task'],
    };
  },
  renderResource: function (resource) {
    return (
      '<div class="mds-tasks-resource-name">' +
      resource.name +
      '</div>' +
      '<div class="mds-tasks-resource-description">' +
      resource.description +
      '</div>'
    );
  },
  renderTimelineEventContent: function (event) {
    return (
      '<div class="mds-tasks-event-title">' +
      event.title +
      '</div>' +
      '<div class="mds-tasks-event-subtitle">Task list</div>' +
      '<div class="mds-tasks-event-list">' +
      event.original.tasks.reduce(function (list, task) {
        return list + '<div class="mds-tasks-event-list-item">' + task + '</div>';
      }, '') +
      '<div class="mds-tasks-event-list-item mds-tasks-event-add">+ Add task</div>' +
      '</div>'
    );
  },
  onEventClick: function (args) {
    if (args.domEvent.target.classList.contains('mds-tasks-event-add')) {
      var ev = args.event;
      mobiscroll.prompt({
        title: 'Add new task to ' + ev.title,
        callback: function (value) {
          if (value) {
            var updatedTasks = ev.tasks.slice();
            updatedTasks.push(value);
            ev.tasks = updatedTasks;
            inst.updateEvent(ev);
            mobiscroll.toast({
              duration: 3000,
              message: 'Tasks updated for ' + ev.title,
            });
          }
        },
      });
    }
  },
  resources: [
    {
      id: 1,
      name: 'Site Plumbing Squad',
      description: 'Elite construction plumbers ensuring flawless pipeline installations on every site.',
      color: '#01adff',
    },
    {
      id: 2,
      name: 'Pipeline Builders',
      description: 'Constructing fluid pathways, one precision connection at a time.',
      color: '#239a21',
    },
    {
      id: 3,
      name: 'Blueprint Plumbers',
      description: 'Turning plans into precise pipelines with expert craftsmanship.',
      color: '#ff4600',
    },
    {
      id: 4,
      name: 'Site Supply Specialists',
      description: 'Delivering essential plumbing materials promptly to construction sites',
      color: '#4981d6',
    },
    {
      id: 5,
      name: 'Infrastructure Installers',
      description: ' Building the backbone of modern plumbing systems efficiently.',
      color: '#f1e920',
    },
    {
      id: 6,
      name: 'Steel Sinks Squad',
      description: 'Installing robust sinks for industrial and commercial settings.',
      color: '#f7961e',
    },
  ],
});

mobiscroll.getJson(
  'https://trial.mobiscroll.com/events-check-list-tasks/',
  function (events) {
    inst.setEvents(events);
  },
  'jsonp',
);
  

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.