This is a migrated thread and some comments may be shown as answers.

Save changes before closing window?

1 Answer 344 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Allan
Top achievements
Rank 1
Veteran
Allan asked on 04 Feb 2021, 01:02 PM

Hello,

Does the Scheduler support this functionality?:

If the user has made some changes to the event and is closing the window without saving. Is i possible to make a warning saying something like "You have made changes to the event. Do you want to save the changes or close the window?"

//Allan

 

1 Answer, 1 is accepted

Sort by
1
Martin
Telerik team
answered on 08 Feb 2021, 11:39 AM

Hello, Allan,

The Scheduler does not provide the functionality out-of-the-box. A possible approach would be to bind and prevent the cancel event which triggers when the cancel button is pressed. You can then use the kendo.confirm dialog and based on the choice of the user, you can use the scheduler saveEvent method or the dataSource cancelChanges event.

cancel: function(e) {

            e.preventDefault();
            var scheduler = e.sender;
            kendo.confirm("You have made changes to the event. Do you want to save the changes or close the window?").then(function () {
              scheduler.saveEvent();
            }, function () {
              scheduler.dataSource.cancelChanges();
            });
          },

Here is a small example for reference. Some custom logic will be needed to capture whether any changes have been made to the event before showing the Popup.

I hope I was helpful. Let me know if you have any further questions.

Regards,
Martin
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Scheduler
Asked by
Allan
Top achievements
Rank 1
Veteran
Answers by
Martin
Telerik team
Share this question
or