In progress wheel in Dojo

2019-08-05 19:51发布

问题:

Is there a "in progress" wheel as a dojo/dijit widget?

My json request takes quite some time and I should show the user that something is going on.

Thanks!

回答1:

I use the StandBy widget to do this. The following snippet shows how. The code is a bit old and doesn't use the deferred technique that Philippe mentioned, but you could easily do so.

var url = ...

var xhrArgs = {
    url: url,
    handleAs: "text",
    load: dojo.hitch(this, function(data) {

      this._standby.hide();

      ... do work ...                   

    }),
    error: dojo.hitch(this, function(error){
      this._standby.hide();
      throw error;
    })
};

if (!this._standby) {
    this._standby = new dojox.widget.Standby({
      target: this.domNode
    });
    dojo.body().appendChild(this._standby.domNode);
}

this._standby.show();
dojo.xhrPost(xhrArgs);


标签: dojo