js/loader: stop pending subcontainer requests

When redrawing a container we should cancel it's subcontainers pending
requests. This also fixes stopPendingRequestsFor(), it didn't really
work before.
This commit is contained in:
Thomas Gelf 2014-06-24 07:01:37 +02:00
parent 90bb20f4c3
commit 0604d30348

View File

@ -141,11 +141,11 @@
stopPendingRequestsFor: function ($el) { stopPendingRequestsFor: function ($el) {
var id; var id;
if (typeof $el !== 'undefined' || ! (id = $el.attr('id'))) { if (typeof $el === 'undefined' || ! (id = $el.attr('id'))) {
return; return;
} }
if (id in this.requests) { if (typeof this.requests[id] !== 'undefined') {
this.requests[id].abort(); this.requests[id].abort();
} }
}, },
@ -623,6 +623,7 @@
renderContentToContainer: function (content, $container, action, autorefresh) { renderContentToContainer: function (content, $container, action, autorefresh) {
// Container update happens here // Container update happens here
var scrollPos = false; var scrollPos = false;
var self = this;
var containerId = $container.attr('id'); var containerId = $container.attr('id');
if (typeof containerId !== 'undefined') { if (typeof containerId !== 'undefined') {
scrollPos = $container.scrollTop(); scrollPos = $container.scrollTop();
@ -644,6 +645,9 @@
event.preventDefault(); event.preventDefault();
}); });
$('.container', $container).each(function() {
self.stopPendingRequestsFor($(this));
});
if (false && if (false &&
$('.dashboard', $content).length > 0 && $('.dashboard', $content).length > 0 &&