Sophie
October 27, 2016, 9:30am
1
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();})
Sophie
October 28, 2016, 2:42am
4
webix.ajax(…).get(…).always is not a function
Sophie
October 28, 2016, 2:44am
5
{
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.