0

如何在不重新加载页面的情况下撤消对我保存的最后一个事件的事件DayPilot.Scheduler操作?Resized

这是我的代码:

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..
    }
};
4

1 回答 1

1

您应该使用onEventResize来显示确认对话框。此事件在默认操作之前调用(而onEventResized在其之后调用)。您可以使用 args.preventDefault() 取消默认操作:

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

将原始操作保留在 onEventResized 处理程序中:

dp.onEventResized = function (args) {
   // submit changes
};
于 2015-04-27T11:44:00.390 回答