We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Disable right click on existing event

Thread ID:

Created:

Updated:

Platform:

Replies:

150016 Dec 18,2019 03:55 AM UTC Dec 20,2019 06:40 AM UTC Angular - EJ 2 3
loading
Tags: Schedule
jose lara
Asked On December 18, 2019 03:56 AM UTC

Hi, I am following this example to create context menu for my scheduler -https://ej2.syncfusion.com/angular/demos/#/material/schedule/context-menu.
How can I disable right clicking on an existing event? if I hide all the items for that scenario, I am seeing an empty context menu upon right clicking, which I don't want. Context menu should only show up on right clicking on empty cells, not existing events. Right clicking on existing events should simply be ignored.

Vinitha Devi Murugan [Syncfusion]
Replied On December 18, 2019 10:42 AM UTC

Hi Jose, 
 
Syncfusion Greetings. 
 
We achieved your requirement by making use of beforeOpen event of context menu and same can be available in below link. 
 

 onContextMenuBeforeOpen(args: BeforeOpenCloseMenuEventArgs): void { 
        let newEventElement: HTMLElement = document.querySelector('.e-new-event') as HTMLElement; 
        if (newEventElement) { 
            remove(newEventElement); 
            removeClass([document.querySelector('.e-selected-cell')], 'e-selected-cell'); 
        } 
        let targetElement: HTMLElement = <HTMLElement>args.event.target; 
        if (closest(targetElement, '.e-contextmenu')) { 
            return; 
        } 
        this.selectedTarget = closest(targetElement, '.e-appointment,.e-work-cells,' + 
            '.e-vertical-view .e-date-header-wrap .e-all-day-cells,.e-vertical-view .e-date-header-wrap .e-header-cells'); 
        if (isNullOrUndefined(this.selectedTarget)) { 
            args.cancel = true; 
            return; 
        } 
        if (this.selectedTarget.classList.contains('e-appointment')) { 
         args.cancel = true; 
            return; 
        } 
        this.menuObj.hideItems(['Save', 'Delete', 'EditRecurrenceEvent', 'DeleteRecurrenceEvent'], true); 
        this.menuObj.showItems(['Add', 'AddRecurrence', 'Today'], true); 
    } 

Kindly try the above solution and let us know, if you need further assistance on this.  

Regards, 
M.Vinitha devi 


jose lara
Replied On December 20, 2019 04:05 AM UTC

thx. this works as expected

Vinitha Devi Murugan [Syncfusion]
Replied On December 20, 2019 06:40 AM UTC

Hi Jose, 
 
Thanks for your update. 
 
We are happy to hear that our solution has fulfilled your requirement.  
 
Regards, 
M.Vinitha devi 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon