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);
});