Issue with dojox/widget/Standby

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue with dojox/widget/Standby

Harry Devine

I have an operation on one of my projects that takes a few seconds to complete.  I'm trying to use dojox/widget/Standby to overlay a standby image, but it doesn't work.  I had it working on another project, and I'm implementing it the same way, but for some reason, I don't get the same behavior.


I also tried to put up a small dijit/Dialog with a "Please Wait" message, but that doesn't show up.  I only get  flash once the operation is complete.  I think I'm running into an asynchronous process timing issue, but I can't get around that using dojo/Deferred.


What I'm doing, in a nutshell:


1) show the dijit/Dialog using the show command

2) call my subfunction to do my operation and use .then to wait for the process to finish. I call dojo/Deferred in the subfunction, resolve it when complete, and return the promise as the last line in the function.

3) once it finishes, the .then kicks in and I hide the dialog


However, like I said, I never see the dialog, only a flash after the function is complete.  Any ideas?  I'll post some code if someone requests it.


Thanks,

Harry



--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|

Re: Issue with dojox/widget/Standby

neekfenwick
I had Standby trouble the other day, first time using it in a year or two, what caught me is that you need to add it to the dom before trying to show it, i.e.

var s = new Standby({target: this.domNode});
s.placeAt(this.domNode); // <-- the bit I forgot
s.startup();
s.show();

As for the dialog approach, it certainly sounds like your code is buggy so we'd need to see the code.  The general approach would be as you describe:

function doWork() {
  var d = new Deferred();
  someAsyncProcess().then(function() {
    d.resolve();
  });
  return d;
}

var dlg = new Dialog({...});
d.show();
doWork().then(function () {
  d.hide();
  d.destroy();
});

Of course, if your code is as simple as the above, the doWork() function isn't required at all, simply call your someAsyncProcess, e.g. a JSONRest query, and call .then() on its returned promise instead of doWork()'s promise.

Nick

On 03/02/17 02:37, Harry Devine wrote:

I have an operation on one of my projects that takes a few seconds to complete.  I'm trying to use dojox/widget/Standby to overlay a standby image, but it doesn't work.  I had it working on another project, and I'm implementing it the same way, but for some reason, I don't get the same behavior.


I also tried to put up a small dijit/Dialog with a "Please Wait" message, but that doesn't show up.  I only get  flash once the operation is complete.  I think I'm running into an asynchronous process timing issue, but I can't get around that using dojo/Deferred.


What I'm doing, in a nutshell:


1) show the dijit/Dialog using the show command

2) call my subfunction to do my operation and use .then to wait for the process to finish. I call dojo/Deferred in the subfunction, resolve it when complete, and return the promise as the last line in the function.

3) once it finishes, the .then kicks in and I hide the dialog


However, like I said, I never see the dialog, only a flash after the function is complete.  Any ideas?  I'll post some code if someone requests it.


Thanks,

Harry






--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|

Re: Issue with dojox/widget/Standby

Jared Jurkiewicz
And make sure you are not using sync as true in an xhr

On Feb 15, 2017 12:43 AM, "Nick Fenwick" <[hidden email]> wrote:
I had Standby trouble the other day, first time using it in a year or two, what caught me is that you need to add it to the dom before trying to show it, i.e.

var s = new Standby({target: this.domNode});
s.placeAt(this.domNode); // <-- the bit I forgot
s.startup();
s.show();

As for the dialog approach, it certainly sounds like your code is buggy so we'd need to see the code.  The general approach would be as you describe:

function doWork() {
  var d = new Deferred();
  someAsyncProcess().then(function() {
    d.resolve();
  });
  return d;
}

var dlg = new Dialog({...});
d.show();
doWork().then(function () {
  d.hide();
  d.destroy();
});

Of course, if your code is as simple as the above, the doWork() function isn't required at all, simply call your someAsyncProcess, e.g. a JSONRest query, and call .then() on its returned promise instead of doWork()'s promise.

Nick

On 03/02/17 02:37, Harry Devine wrote:

I have an operation on one of my projects that takes a few seconds to complete.  I'm trying to use dojox/widget/Standby to overlay a standby image, but it doesn't work.  I had it working on another project, and I'm implementing it the same way, but for some reason, I don't get the same behavior.


I also tried to put up a small dijit/Dialog with a "Please Wait" message, but that doesn't show up.  I only get  flash once the operation is complete.  I think I'm running into an asynchronous process timing issue, but I can't get around that using dojo/Deferred.


What I'm doing, in a nutshell:


1) show the dijit/Dialog using the show command

2) call my subfunction to do my operation and use .then to wait for the process to finish. I call dojo/Deferred in the subfunction, resolve it when complete, and return the promise as the last line in the function.

3) once it finishes, the .then kicks in and I hide the dialog


However, like I said, I never see the dialog, only a flash after the function is complete.  Any ideas?  I'll post some code if someone requests it.


Thanks,

Harry






--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest


--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest