Multi-Select & Bulk Event Actions
Usage
theme: 'ios' You can turn auto theming on and let it decide based on the platform.
Usage
themeVariant: 'light' You can turn auto dark mode on based on system settings.
Usage
clickToCreate: true,
// click to create is on dragToCreate: true,
// drag to create is on dragToMove: true,
// reordering is on dragToResize: true,
// resizing is on eventDelete: true
// deleting is on Fine-tune drag & drop with these options, which are false by default.
Usage
locale: localeEn Selecting the locale loads the localized settings and the translated UI text.
Multi-Select & Bulk Event Actions
Multiple event selection can be turned on with the selectMultipleEvents option. Selecting multiple events can be done through user interaction with CTRL/SHIFT/CMD + click or programmatically eg. click of a button or 'select all' checkbox.
Bulk operations like delete, update can be applied the selected events. Things like deleting with the backspace or delete buttons work out of the box but custom actions can be also applied. The selection can be easily retrieved and updated with the selectedEvents option and the onSelectedEventsChange event.
Custom actions can be performed with external buttons or with context menu activated on right-click.
Demo

Code
import { CommonModule } from '@angular/common';
import { HttpClient } from '@angular/common/http';
import { Component, OnInit, ViewChild } from '@angular/core';
import { FormsModule } from '@angular/forms';
import {
formatDate,
MbscCalendarEvent,
MbscEventcalendar,
MbscEventcalendarOptions,
MbscModule,
MbscSelect,
MbscSelectOptions,
Notifications,
setOptions ,
} from '@mobiscroll/angular';
setOptions({
locale: ,
theme: ' ',
themeVariant: ' '
});
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
providers: [Notifications],
standalone: true,
imports: [CommonModule, FormsModule, MbscModule],
})
export class AppComponent implements OnInit {
constructor(
private http: HttpClient,
private notify: Notifications,
) {}
@ViewChild('calendar', { static: false })
calendar!: MbscEventcalendar;
@ViewChild('menu', { static: false })
menu!: MbscSelect;
myEvents: MbscCalendarEvent[] = [];
mySelectedEvents: MbscCalendarEvent[] = [];
eventTitles: string[] = [];
selectValue: string | null = null;
firstDay!: Date;
lastDay!: Date;
menuAnchor!: HTMLElement;
confirmOpen = false;
getSelectedEventTitles(events: MbscCalendarEvent[]) {
let titles: string[] = [];
for (const event of events) {
titles = [...titles, event.title!];
}
return titles;
}
refreshSelectedEvents(events: MbscCalendarEvent[]) {
this.mySelectedEvents = events;
this.eventTitles = this.getSelectedEventTitles(events);
}
updateSelectedEvents() {
const events = this.mySelectedEvents;
let eventsToUpdate = [...this.myEvents];
for (const event of events) {
if (event.recurring) {
const origEvent = event.original!;
const exc = (origEvent.recurringException as string[]) || [];
const newEvent = event;
newEvent.recurring = undefined;
newEvent.color = 'orange';
newEvent.id += '_' + formatDate('YYYY-MM-DD', new Date(event.start as string));
eventsToUpdate = [...eventsToUpdate, newEvent];
origEvent.recurringException = [...exc, event.start];
// Update the event in the list
const index = eventsToUpdate.findIndex((x) => x.id === origEvent['id']);
eventsToUpdate.splice(index, 1, origEvent);
} else {
const newEv = event;
newEv.color = 'orange';
const index = eventsToUpdate.findIndex((x) => x.id === newEv.id);
eventsToUpdate.splice(index, 1, newEv);
}
}
this.myEvents = eventsToUpdate;
this.refreshSelectedEvents([]);
this.notify.toast({
message: "All selected event's color changed to orange",
});
}
deleteSelectedEvents() {
this.confirmOpen = true;
this.notify.confirm({
title: 'Are you sure you want to delete the following events?',
message: this.getSelectedEventTitles(this.mySelectedEvents).join(','),
okText: 'Delete',
callback: (result) => {
if (result) {
let eventsToUpdate = [...this.myEvents];
for (const event of this.mySelectedEvents) {
if (event.recurring) {
const origEvent = event.original!;
const exc = (origEvent.recurringException as string[]) || [];
origEvent.recurringException = [...exc, event.start];
// Update the event in the list
const index = eventsToUpdate.findIndex((x) => x.id === origEvent['id']);
eventsToUpdate.splice(index, 1, origEvent);
} else {
eventsToUpdate = eventsToUpdate.filter((ev) => ev.id !== event.id);
}
}
this.myEvents = eventsToUpdate;
this.refreshSelectedEvents([]);
this.notify.toast({
message: 'Deleted',
});
}
this.confirmOpen = false;
},
});
}
calendarOptions: MbscEventcalendarOptions = {
clickToCreate: ,
dragToCreate: ,
dragToMove: ,
dragToResize: ,
eventDelete: ,
selectMultipleEvents: true,
view: {
timeline: {
type: 'week',
},
},
resources: [
{
id: 1,
name: 'Ryan',
color: '#fdf500',
},
{
id: 2,
name: 'Kate',
color: '#ff4600',
},
{
id: 3,
name: 'John',
color: '#ff0101',
},
{
id: 4,
name: 'Mark',
color: '#239a21',
},
{
id: 5,
name: 'Sharon',
color: '#8f1ed6',
},
{
id: 6,
name: 'Ashley',
color: '#01adff',
},
],
onEventUpdate: (args) => {
if (args.isDelete) {
if (!this.confirmOpen) {
this.deleteSelectedEvents();
}
return false;
}
return true;
},
onEventDelete: () => {
if (!this.confirmOpen) {
this.deleteSelectedEvents();
}
return false;
},
onPageLoading: (args) => {
setTimeout(() => {
this.firstDay = args.firstDay;
this.lastDay = args.lastDay;
});
},
onSelectedEventsChange: (args) => {
this.refreshSelectedEvents(args.events);
},
onEventRightClick: (args) => {
args.domEvent.preventDefault();
this.menuAnchor = args.domEvent.target;
setTimeout(() => {
this.menu.open();
});
},
};
menuOptions: MbscSelectOptions = {
touchUi: false,
display: 'anchored',
buttons: [],
data: [
{ value: 'update', text: 'Update' },
{ value: 'delete', text: 'Delete' },
],
onChange: (args) => {
if (args.value === 'update') {
this.updateSelectedEvents();
} else if (args.value === 'delete') {
this.deleteSelectedEvents();
}
},
onClose: () => {
setTimeout(() => {
// Clear selection
this.selectValue = null;
});
},
};
selectAllEvents() {
this.refreshSelectedEvents(this.calendar.getEvents(this.firstDay, this.lastDay));
this.notify.toast({
message: 'All events selected from view',
});
}
resetSelection() {
this.refreshSelectedEvents([]);
this.notify.toast({
message: 'Selection cleared',
});
}
onKeyDown(ev: any) {
if (!this.confirmOpen && (ev.keyCode === 8 || ev.keyCode === 46)) {
this.deleteSelectedEvents();
}
}
ngOnInit(): void {
this.http.jsonp<MbscCalendarEvent[]>('https://trial.mobiscroll.com/timeline-events/', 'callback').subscribe((resp) => {
this.myEvents = resp;
});
}
}
<mbsc-page class="md-bulk-operations" (keydown)="onKeyDown($event)">
<div class="mbsc-grid mbsc-no-padding">
<div class="mbsc-row">
<div class="mbsc-col-sm-9 mbsc-push-sm-3 md-bulk-operations-border">
<mbsc-eventcalendar
#calendar
[(selectedEvents)]="mySelectedEvents"
[data]="myEvents"
[options]="calendarOptions"
></mbsc-eventcalendar>
<mbsc-select style="display: none" #menu [(ngModel)]="selectValue" [anchor]="menuAnchor" [options]="menuOptions"> </mbsc-select>
</div>
<div class="mbsc-col-sm-3 mbsc-pull-sm-9">
<div class="mbsc-form-group">
<div class="mbsc-button-group-block">
<mbsc-button (click)="selectAllEvents()">Select all from view</mbsc-button>
<mbsc-button (click)="resetSelection()">Reset selection</mbsc-button>
<mbsc-button (click)="updateSelectedEvents()">Update selected</mbsc-button>
</div>
</div>
<div class="mbsc-form-group-title">Currently selected</div>
<div class="mbsc-padding md-selected-event-list">
<ul>
<li *ngFor="let title of eventTitles;">{{title}}</li>
</ul>
</div>
</div>
</div>
</div>
</mbsc-page>
.md-bulk-operations-border {
border-left: 1px solid #ccc;
}
.md-selected-event-list {
height: 500px;
overflow: auto;
padding-top: 0;
padding-bottom: 0;
}