DayPilot.Scheduler.onEventResize

The onEventResize(args) event handler is called when the user finishes the drag and drop event resizing (i.e. on drop). It is called before the default action (which is set using eventResizeHandling property).

Canceling the Default Action

You can cancel the default action synchronously using args.preventDefault() method if needed - especially if the operation doesn't meet your business rules.

You can also check the rules asynchronously (e.g. when you need to make an AJAX call to the server to check the rules) by setting args.async to true. In that case the default action will only be performed when you call args.loaded().

You may want to use blockOnCallBack property to disable the UI while the Scheduler is waiting for the response. Don't forget to call args.loaded() when the operation is finished to unblock the UI.

Parameters

  • args.async - enables asynchronous update (boolean)
  • args.e - the event being resized (DayPilot.Event object)
  • args.loaded() - continues processing when asynchronous update is enabled
  • args.multiresize - array of additional events that are resized during multi-resizing
  • args.newStart - new event start (DayPilot.Date object)
  • args.newEnd - new event end (DayPilot.Date object)
  • args.preventDefault() - terminates further processing (the default action and onEventResized will not be called)

Examples

Simple synchronous validation

dp.onEventResize = function (args) {
  if (args.e.id() === "3") {
    args.preventDefault();
    dp.message("Event 3 cannot be resized.");
  }
};

Asynchronous validation

dp.onEventResize = function(args) {
    args.async = true;
    dp.message("Checking....");

    $.ajax({
        url: "/api/validateResize",
        method: "GET",
        data: {
            dateFrom: args.newStart.toString(),
            dateTo: args.newEnd.toString(),
            id: args.e.id()
        }
    }).done(function (response) {
        var $response = $.parseJSON(response);

        if ($response.error) {
            dp.message($response.message);
            args.preventDefault();
        }
        args.loaded();
    });
};

api=1

In api=1 mode this event is only called if eventResizeHandling is set to "JavaScript".

Declaration

onEventResize(e, newStart, newEnd)

Parameters