kendo-uikendo-progressbar

kendo ui requestEnd never gets called


Trying to add spinner (kendo.ui.progress) to show crud operations in process, for create start spinner in save event and end in databound but for delete(destroy) start in remove event, but there is no way to tell when destroy is completed. There is event requestEnd but it never gets called -- probably it is not supported in older version of kendo ui.

There is one more way which is define ajax function inside destroy operation like destroy:function(options){$.ajax...} and in success or failure callbacks of ajax stop spinner but I do not want to do this.

Is there a way I can know when the destroy operation completed other than the above two mentioned solutions?


Solution

  • Using requestStart, sync, requestEnd to show and hide a spinner is not wise. This way you have to write code for showing and hiding spinner in every datasource. what happens if the code of showing/hiding changed?

    Better idea is defining a global handler to show spinner after first request and hide spinner after last response. Global Ajax Event Handlers is best in this scenarios.

    .ajaxStart():Register a handler to be called when the first Ajax request begins.

    .ajaxStop():Register a handler to be called when all Ajax requests have completed.


    example:

    $( document ).ajaxStart(function() {
        kendo.ui.progress($("#app"), true);
    });
    //----------------------------------------------
    $( document ).ajaxStop(function() {
        kendo.ui.progress($("#app"), false);
    });