From 947e015ca0e84926cd115c1a79f31dd83fed2920 Mon Sep 17 00:00:00 2001 From: piwi91 Date: Mon, 30 Mar 2015 10:48:59 +0200 Subject: [PATCH] Unblock UI if all AJAX calls are finished --- Resources/private/js/bluetea/blockUi.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Resources/private/js/bluetea/blockUi.js b/Resources/private/js/bluetea/blockUi.js index f1b9529..f405cc1 100755 --- a/Resources/private/js/bluetea/blockUi.js +++ b/Resources/private/js/bluetea/blockUi.js @@ -8,6 +8,7 @@ $(function() { // Private variables _isUiBlocked: false, + _blockCount: 0, /** * Block UI @@ -41,14 +42,18 @@ $(function() { overlayCSS: { zIndex: 2000, backgroundColor: '#000', opacity: 0.9, cursor: 'wait' } }); } + this._blockCount++; }, /** * Unblock the UI */ unblockUI: function() { - this._isUiBlocked = false; - $.unblockUI(); + this._blockCount--; + if (this._blockCount == 0) { + this._isUiBlocked = false; + $.unblockUI(); + } }, /** @@ -91,4 +96,4 @@ $(function() { $.Widget.prototype.destroy.call(this); } }); -}(jQuery)); \ No newline at end of file +}(jQuery));