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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Prevent appointment window deletion from closing after remove click

Thread ID:

Created:

Updated:

Platform:

Replies:

143017 Feb 28,2019 02:50 PM UTC Mar 6,2019 03:41 AM UTC ASP.NET Core - EJ 2 5
loading
Tags: Scheduler
Gregory Perozzo
Asked On February 28, 2019 02:53 PM UTC

Hello!

I've already asked a similar question here https://www.syncfusion.com/forums/141540/prevent-new-appointment-window-from-closing-after-save-click but I think the behavior of the appointment deletion is different.

After I click "remove", a confirmation window appears and I think that's what's causing my code not to work.





And this is the code I'm using:

onActionBegin:

            if (args.requestType === 'eventRemove') {

                var removeData = args.data[0];

                if (removeData.Status !== "Agendada") {
                    args.cancel = true;
                    blockDelete = true;
                    return;
                }
            }

onDataBound:

            var scheduleObj = document.getElementById('schedule').ej2_instances[0];

            scheduleObj.eventWindow.dialogObject.beforeClose = function (args) {

                if (blockEdit === true) {
                    args.cancel = blockEdit;
                    blockEdit = false;
                    alert("A aula já foi realizada. Não é possível alterar a mesma.");
                    return;
                }
                // This code is not getting executed
                else if (blockDelete === true) {
                    args.cancel = blockDelete;
                    blockDelete = false;
                    alert("A aula já foi realizada. Não é possível remover a mesma.");
                    return;
                }
            }
        }

What am I doing wrong?

Thank you!

Gregory Perozzo
Replied On March 1, 2019 04:39 PM UTC

Hello,

Anyone can help?

Gregory Perozzo
Replied On March 4, 2019 02:00 PM UTC

Hello,

Already resolved this by using the Readonly property of a schedule event.

Thank you very much.

Nevitha Ravi [Syncfusion]
Replied On March 5, 2019 09:18 AM UTC

Hi Gregory, 

 
We regret for the delayed post. 

 
We have checked the reported problem at our end which is due to actionBegin will trigger only after the delete confirmation dialog. So we have prepared the sample for your requirement by opening the editor manually using openEditor public method which can be downloaded from the following link. 

 
<Code> 
<script type="text/javascript">
var flag = false;
function onActionBegin(args) {
 if (args.requestType === 'eventCreate' || args.requestType === 'eventChange') {
var subject = (args.requestType === 'eventCreate') ? args.data[0].Subject : (args.data).Subject;
if (subject == 'New') {
args.cancel = true;
flag = true;
}
}
if (args.requestType === 'eventRemove') {
var sub = args.data[0].Subject;
if (sub == 'Meeting') {
args.cancel = true;
 var sch = document.querySelector(".e-schedule").ej2_instances[0];
 sch.openEditor(args.data[0], "Save");
}
}
}
function onDataBound() {
var scheduleObj = document.getElementById('schedule').ej2_instances[0];
scheduleObj.eventWindow.dialogObject.beforeClose = function (args) {
args.cancel = flag;
flag = false;
}
}
</script> 
</Code> 

 
Regards, 
Nevitha 


Gregory Perozzo
Replied On March 5, 2019 08:47 PM UTC

Hi Nevitha,

How are you?

No problem! Thank you very much for your response anyway!

Have a nice day!


Karthigeyan Krishnamurthi [Syncfusion]
Replied On March 6, 2019 03:41 AM UTC

Hi Gregory,

Thanks for your update.

Regards,
Karthigeyan


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

;