0

How to undo the action DayPilot.Scheduler on event Resized on the last event i saved without reloading the page?

Here is my code:

dp.onEventResized = function (args) {
    if (confirm('Are you sure you want to edit this?')) {
        --do some code --
    }
    else
    {             
        window.location.reload();
        //undo the last event..
    }
};
chiwangc
  • 3,566
  • 16
  • 26
  • 32
Eddie
  • 1
  • 2

1 Answers1

1

You should use onEventResize to display the confirmation dialog. This event is called before the default action (while onEventResized is called after it). You can cancel the default action using args.preventDefault():

dp.onEventResize = function (args) {
  if (!confirm('Are you sure you want to edit this?')) {
  {             
    args.preventDefault();
  }
};

Keep the original action in the onEventResized handler:

dp.onEventResized = function (args) {
   // submit changes
};
Dan
  • 2,157
  • 21
  • 15