search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

onEventMove - cancel on server error

Asked by Christos Georgiou
5 years ago.

I am trying to find a way to cancel the event upon error but with no luck.

I have the
//an ajax call

But I don't know how to STOP the moved box from going to the moved position IF the ajax call returned an error

Answer posted by Dan Letecky [DayPilot]
5 years ago.


Take a look at the "Asynchronous Validation" demo:

    dp.onEventMove = function(args) {
        args.async = true;

            url: "asyncvalidation.txt",
            method: "GET",
            data: {
                dateFrom: args.newStart.toString(),
                dateTo: args.newEnd.toString(),
        }).done(function (response) {
            var $response = $.parseJSON(response);

            if ($response.error) {

This code assumes the server returns a valid response (any server-side error will be returned using .error property in the response JSON). You can extend it easily for other types of server-side failure by adding .fail() handler to the $.ajax() call.

Note the key parts:
* Switch to async handling using args.async = true
* Cancel the action using args.preventDefault();
* Confirm the action using args.loaded();

Comment posted by Christos Georgiou
5 years ago.

Alright.. this seems to work but now I have another problem.

I have set blockOnCallBack = true
and my onEventMove = function(args) {

args.async = true;

if (!confirm('Are you sure you want to edit this?')) {

// some code


The problem is that the ui is blocked even if I click on "cancel" on confirm box, like the args.loaded() not working properly

This question is more than 3 months old and has been closed. Please create a new question if you have anything to add.