A question about the progress bar

code:

 {
                view:"datatable",
                id:"data",
                autoConfig:true,
                data: [],
},

webix.extend($$("total_datatable1"), webix.ProgressBar);
$$("data").disable();
$$("data").showProgress({
delay:30000,
hide:true
});

setTimeout(function(){
webix.ajax().get("AJAX-URL",function(text){
$$("data").clearAll();
$$("data").parse(text);
$$("data").enable();
})
}, 1000);

If I use the progress bar,delay set 30000,

How should I write this, can make the schedule of the time just equal to my Ajax response time,dynamic change.

you should use hideProgress instead of setting delay. as webix.ajax().get returns an instance of promise, you can call hideProgress in “always” handler.

webix.ajax().get("AJAX-URL",function(text){ 
   $$("data").clearAll(); 
   $$("data").parse(text); 
   $$("data").enable();
}).always(function(){$$('data').hideProgress();})

thank you

webix.ajax(…).get(…).always is not a function

{
view:“datatable”,
id:“data”,
autoConfig:true,
data: [],
},

webix.extend($$(“data”), webix.ProgressBar);
$$(“data”).disable();
$$(“data”).showProgress({
//delay:30000,
//hide:true
});

//setTimeout(function(){
webix.ajax().get(“AJAX-URL”,function(text){
$$(“data”).clearAll();
$$(“data”).parse(text);
$$(“data”).enable();
})
//}, 1000);

that is OK

Try ‘done’ if ‘always’ is not a function

Please check the related docs. You can use the .then() handler or just apply hideProgress() within the AJAX callback.