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. Image for the cookie policy date

Show delete alert confirmation when selecting delete option from context menu

Hello,

I need to show delete alert confirmation when selecting 'delete appointment' from the context menu.

Today, when I select the delete option, the appointment is deleted without any confirmation.

This is the context menu code:

        function onMenuItemSelect(args) {
            var scheduleObj = document.querySelector(".e-schedule").ej2_instances[0];
            var selectedMenuItem = args.item.id;
            var eventObj;

            if (selectedTarget.classList.contains('e-appointment')) {
                eventObj = scheduleObj.getEventDetails(selectedTarget);
            }

            switch (selectedMenuItem) {
                case 'Today':
                    scheduleObj.selectedDate = new Date();
                    break;
                case 'Add':
                    var selectedCells = scheduleObj.getSelectedElements();
                    var activeCellsData = scheduleObj.getCellDetails(selectedCells.length > 0 ? selectedCells : selectedTarget);
                    if (selectedMenuItem === 'Add') {
                        scheduleObj.openEditor(activeCellsData, 'Add');
                    } else {
                        scheduleObj.openEditor(activeCellsData, 'Add', null, 1);
                    }
                    break;
                case 'Save':
                    scheduleObj.openEditor(eventObj, selectedMenuItem);
                    break;
                case 'Delete':
                    scheduleObj.deleteEvent(eventObj);
                    break;
            }
        }

When I select the delete option within edit dialog it shows the confirmation:





How can I do that?

3 Replies

KK Karthigeyan Krishnamurthi Syncfusion Team April 1, 2019 10:15 AM UTC

Hi Gregory, 
 
Greeting from Syncfusion. 
 
We have prepared the below sample to display the alert while deleting the event, kindly use the below code example. 
 
case 'Delete':
         scheduleObj.activeEventData.event = eventObj;
         scheduleObj.quickPopup.openDeleteAlert();
         break;
 
 
 
Regards, 
Karthi 



GP Gregory Perozzo April 1, 2019 11:10 AM UTC

Hello Karthigeyan, how are you?

Your code sample worked perfectly!

Thank you very much.

Can you help me in my other question thread about CRUD operations in the scheduler?


Thank you!


KK Karthigeyan Krishnamurthi Syncfusion Team April 2, 2019 11:50 AM UTC

Hi Gregory,  
 
Most welcome 😊 
 
We will check 143650 and provide the details in that forum as soon as possible. Kindly have a follow-up it for further details. 
 
Regards, 
Karthi 


Loader.
Up arrow icon