One loader by $.LoadingOverlay
Tsyklop opened this issue · 9 comments
Hello. Can you add new option?
Option named a single
(otherwise possible). That means the loader will be one on page.
If i call this code $.LoadingOverlay('show');
more one time, on the page there will be as many loaders as I call.
It would be convenient to have the option single
, which allows not to create a large number of loaders, but only one. $.LoadingOverlay('show', {signle: true});
Actually it is already like this: only a single LoadingOverlay is ever shown at a given time, but it keeps a counter of how many instances you requested.
If you don't want to be bothered hiding them all, simply use the force
parameter in the hide method: $.LoadingOverlay("hide", true);
@gasparesganga force
is working perfect. But i have async requests to server and they run on different time. I can't hide all loaders while other requests are runned
I don't really get the problem then. How and when are you showing the LoadingOverlays? If you are showing a LoadingOverlay before the async request, why don't you simply hide it when the request is complete (regardless of the return state, using an .always()
promise for example)? That way should be much cleaner and actually the way I have always used it since its first design.
$.LoadingOverlay("show");
$.ajax({
url : "some/url/here"
}).always(function(){
$.LoadingOverlay("hide");
});
Or use a setup like the one suggested in Example 6 in the documentation
Any news about that...?
Okey. I try your option 6.
I call two ajax request at once.
First request finished quickly, but Second need more time. And when first request complete he hide overlay, but second request did not ended.
Consequently. Is misinformation about the process of executing the query.
Thanks a lot.
It sounds like you are using the force
option there. If you want to use the code provided in Example 6 you do not have to set force
to true.
It's working pretty well in my tests.
No. I don't use this option. I use this: $.LoadingOverlay('show');
and $.LoadingOverlay('hide');
I can't help you, the same exact code from Example 6, copied/pasted in a new page produces the expected results...
Are you sure you aren't calling a $.LoadingOverlay('hide');
somewhere else in your code?