Description
As discussed here http://www.nabble.com/Ajax-indicator-turning-off-td24655744.html
Overlapping AJAX calls result in the indicator being turned off when the first call returns. This patch keeps a count property directly on the HTMLElement so when the element goes out of scope the count does not need to be removed. Each AJAX call increments the counter and each return decrements the counter.
Index: src/main/java/org/apache/wicket/ajax/wicket-ajax.js
===================================================================
— src/main/java/org/apache/wicket/ajax/wicket-ajax.js (revision 797714)
+++ src/main/java/org/apache/wicket/ajax/wicket-ajax.js (working copy)
@@ -2214,3 +2214,31 @@
e.style.display = "none";
}
}
+
+function wicketIncrementDisplay(id) {
+ var e=wicketGet(id);
+ if (typeof(e.wicketDisplayCount) =="undefined")
else
{ + e.wicketDisplayCount++; + }+
+ if (e.wicketDisplayCount > 0)
+}
+
+function wicketDecrementDisplay(id) {
+ var e=wicketGet(id);
+ if (typeof(e.wicketDisplayCount) =="undefined")
else
{ + e.wicketDisplayCount--; + }+
+ if (e.wicketDisplayCount <= 0)
+}
+
+
Index: src/main/java/org/apache/wicket/ajax/AbstractDefaultAjaxBehavior.java
===================================================================
— src/main/java/org/apache/wicket/ajax/AbstractDefaultAjaxBehavior.java (revision 797714)
+++ src/main/java/org/apache/wicket/ajax/AbstractDefaultAjaxBehavior.java (working copy)
@@ -183,7 +183,7 @@
if (!Strings.isEmpty(indicatorId))
{ - String hide = ";wicketHide('" + indicatorId + "');"; + String hide = ";wicketDecrementDisplay('" + indicatorId + "');"; success = success + hide; failure = failure + hide; }@@ -240,7 +240,7 @@
if (!Strings.isEmpty(indicatorId))
{ - call = new AppendingStringBuffer("wicketShow('").append(indicatorId) + call = new AppendingStringBuffer("wicketIncrementDisplay('").append(indicatorId) .append("');") .append(call); }