You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Hudson (JIRA)" <ji...@apache.org> on 2010/08/28 20:28:58 UTC

[jira] Commented: (WICKET-2401) AJAX indicator turns off when calls overlap

    [ https://issues.apache.org/jira/browse/WICKET-2401?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12903857#action_12903857 ] 

Hudson commented on WICKET-2401:
--------------------------------

Integrated in Apache Wicket 1.4.x #129 (See [https://hudson.apache.org/hudson/job/Apache%20Wicket%201.4.x/129/])
    

> AJAX indicator turns off when calls overlap
> -------------------------------------------
>
>                 Key: WICKET-2401
>                 URL: https://issues.apache.org/jira/browse/WICKET-2401
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4.0
>            Reporter: John Patterson
>            Assignee: Igor Vaynberg
>             Fix For: 1.4.11, 1.5-M2
>
>
> 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") {
> +    	e.wicketDisplayCount = 1;
> +    } else {
> +    	e.wicketDisplayCount++;
> +    }
> +    
> +	if (e.wicketDisplayCount > 0) {
> +	    e.style.display = "";
> +	}
> +}
> +
> +function wicketDecrementDisplay(id) {
> +    var e=wicketGet(id);
> +    if (typeof(e.wicketDisplayCount) =="undefined") {
> +    	e.wicketDisplayCount = 0;
> +    } else {
> +    	e.wicketDisplayCount--;
> +    }
> +    
> +	if (e.wicketDisplayCount <= 0) {
> +	    e.style.display = "none";
> +	}
> +}
> +
> +
> 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);
>  		}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.