Pergunta

My kendo scheduler contains a remove event

..      
e.Remove("scheduler_remove");
})

and the function is

function scheduler_remove(e){
    $.ajax({
        url: '@Url.Action("ValidateTaskForAddingBreak", "Home")',
        type: "POST",
        success: function (da) {
           alert("im a success");
        }
   }
}

The problem is, that it is making the ajax call before the task is removed. I have also tried to use the e.DataBound, or e.DataBinding , but it will be called several places where it should not be called then.

Is there a way to let the event happen first, and then get to the ajax call ?

Foi útil?

Solução

I found a way to do it:

If i added a timeout for it, it would be called after the event had finished

    function scheduler_remove(e) {
      setTimeout(function () {
        $.ajax({
          url: '@Url.Action("ValidateTaskForAddingBreak", "Home")',
          type: "POST",
          success: function (da) {
            alert("im a success");
          }
        });
      }, 500);
    }
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top