Can I trigger the context menu on multiple selected events?

Hello,

i am wondering if I can trigger the context menu when i have selected multiple events in the scheduler. Obviously i will need to get a list of the selected events for further actions. A use case would be to delete multiple events by right-click -> delete.

Thanks

Panagiotis


1 Reply

VR Vijay Ravi Syncfusion Team May 24, 2024 11:34 AM UTC

Hi Kolokouris,


Based on your requirement, we prepared an Angular Schedule with context menu sample. To select multiple events use ctrl + single click and mouse right click to select the Delete option in context menu to delete all selected appointments. Refer to the shared sample for your reference. Kindly try it out.


[app.component.html]


<ejs-schedule

      #scheduleObj

      height="650px"

      [selectedDate]="selectedDate"

      [allowResizing]="allowResizing"

      [allowDragAndDrop]="allowDragDrop"

      [eventSettings]="eventSettings"

      (eventClick)="eventClick($event)"

    >

    </ejs-schedule>

    <ejs-contextmenu

      #menuObj

      cssClass="schedule-context-menu"

      target=".e-schedule"

      [items]="menuItems"

      (beforeOpen)="onContextMenuBeforeOpen($event)" 

      (select)='onMenuItemSelect($event)'></ejs-contextmenu

    >


[app.component.ts]


public eventClick(args: any) {

    this.multiselectEvents.push(this.scheduleObj.getEventDetails(args.element));

  }
 

public onMenuItemSelect(args: MenuEventArgs): void {

         case 'Delete':

              this.multiselectEvents.forEach((eventObj) => {

              this.scheduleObj.deleteEvent(eventObj);

              this.multiselectEvents = [];

         });

        break;

    }

  }


Sample link: delete multiple event using context menu (forked) - StackBlitz


Please get back to us if you need any further assistance.


Regards,

Vijay


Loader.
Up arrow icon