Dynamic Resource Filtering

Resources can be dynamically turned on and off. This will show or hide the resource and can be done runtime the same way as for any other calendar option.

Download and try example

Demo

Loading the live demo

Preview in full screen

Show or hide resources in a Scheduler at runtime using a checklist — filter people, teams, or rooms without changing event data.

Code

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

var myResources = [
  {
    id: 1,
    name: 'Ryan',
    color: '#f7c4b4',
  },
  {
    id: 2,
    name: 'Kate',
    color: '#c6f1c9',
  },
  {
    id: 3,
    name: 'John',
    color: '#e8d0ef',
  },
];

var calendar = mobiscroll.eventcalendar('#demo-dynamic-filter', {
  clickToCreate: true,
  dragToCreate: true,
  dragToMove: true,
  dragToResize: true,
  view: {
    scheduler: {
      type: 'week',
      allDay: false,
      startDay: 1,
      endDay: 5,
      startTime: '08:00',
      endTime: '17:00',
    },
  },
  resources: myResources,
});

var checkboxList = document.querySelectorAll('.demo-shared-events-checkbox');

checkboxList.forEach(function (elm) {
  elm.addEventListener('change', function () {
    var selected = {};

    for (var i = 0; i < checkboxList.length; i++) {
      var checkbox = checkboxList[i];
      selected[+checkbox.value] = checkbox.checked;
    }

    calendar.setOptions({
      resources: myResources.filter(function (r) {
        return selected[r.id];
      }),
    });
  });
});

mobiscroll.getJson(
  'https://trial.mobiscroll.com/resource-events-shared/',
  function (events) {
    calendar.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.