ExtJS loadMask:管理多ajax调用中的多个loadMask
在我的应用程序中,我需要同时执行多个 ajax 请求,但每个请求根据响应大小需要不同的时间。为了避免在ajax请求期间进行进一步的操作,我想在每个ajax调用中使用Ext.LoadMask,如下所示:
for(var i=0; i<ajaxCount; i++) {
var loadMask = new Ext.LoadMask(Ext.getBody(), {msg:"Loading " + ajaxName[i]});
Ext.Ajax.request({
success: function() {
loadMask.hide();
},
failure: function() {
loadMask.hide();
}
}
}
但是,我发现hide()将隐藏内存中的所有loadMaskes。我想做的只是隐藏这个ajax请求中的一个,这样在所有请求结束之前总是有一个掩码。
还有另一种方法可以实现吗?
谢谢!
In my app, I need to execute several ajax requests at the same time, but each request takes various time based upon response size. In order to avoid further operations during ajax request, I'd like to use Ext.LoadMask in each ajax call, like this:
for(var i=0; i<ajaxCount; i++) {
var loadMask = new Ext.LoadMask(Ext.getBody(), {msg:"Loading " + ajaxName[i]});
Ext.Ajax.request({
success: function() {
loadMask.hide();
},
failure: function() {
loadMask.hide();
}
}
}
however, i found out that the hide() will hide all of loadMaskes in the memory. What I want to do is only hide the one in this ajax request, so that there is always a mask until the end of all requests.
Is there another way of implementing this?
thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为什么不对所有请求使用一个相同的掩码,并在所有请求返回后将其删除?
Why not using one the same mask for all the requests and removing it once all the requests are returned?