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).
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.
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(); }); };
In api=1 mode this event is only called if eventResizeHandling is set to "JavaScript".
onEventResize(e, newStart, newEnd)