spinner/loader waiting ajax request to be finished

hi,

i don’t know how to proceed to display a spinner during a big ajax request because my request need many seconds to load all data.

http://docs.webix.com/desktop__progress.html

I don’t see sorry how to use a progress bar with this

webix.ajax().get(“myUrl’”, function(text, data) {

};

can you please give me an exemple ?

help

Hi, check the following snippet, please: http://webix.com/snippet/c9801684

In the real Ajax request you won’t need the webix.delay() wrapper, as it just emulates the time you will wait for the serverside response.

a huge thank helga, but can we stop ajax request which are being processed before reloading it. Because because before execute this code i want to kill ajax request still processing.

webix.ui({

rows:[

{ view:"button", value:"Load data", click:function(){

  $$("grid").clearAll();

  $$("grid").showProgress({hide:false});

//KILL ALL AJAX RESQUEST STILL WORKING

  webix.ajax().get("myUrl", function(text, data) {

    webix.delay(function(){

      	data = grid_data; 
      	
    	$$("grid").parse(data);

    }, null, null, 1000);
    
  });

}},

{  view:"datatable", height:500, id:"grid", autoConfig:true }

]
});

webix.extend($$(“grid”), webix.ProgressBar);

As far as I can see, there is no public API to abort the standalone ajax call

How can we implement a progress callback for AJAX operations?

The goal is to display a realistic progress bar when loading or uploading data, that takes into account the size of the payload (when POST-ing) or the Content-Length (when fetching) and the amount transferred so far.

Hello,

You can try to use onprogress event of XMLHttpRequest.

// for data load
xhr.onprogress = function(event){
    console.log(event.loaded +" / " + event.total);
};
// for upload
xhr.upload.onprogress = function(event){
    console.log(event.loaded +" / " + event.total);
};

webix.ajax fires onBeforeAjax event. And the 4th parameter of the event handler is XMLHttpRequest object.

Here is the demo with webix.ajax loading and webix.Overlay to show loading status :

http://webix.com/snippet/58d8290d