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

Igor Vaynberg commented on WICKET-3513:
---------------------------------------

i think you have this all wrong, here is a concrete sample of generated 
javascript:

{code}
if (function(){return Wicket.$('id6') != null;}.bind(this)()) { 
Wicket.showIncrementally('id6--ajax-indicator');}var 
wcall=wicketAjaxGet('?wicket:interface=:0:c3-link::IBehaviorListener:0:',function()
 { ;Wicket.hideIncrementally('id6--ajax-indicator');}.bind(this),function() { 
;Wicket.hideIncrementally('id6--ajax-indicator');}.bind(this), function() 
{return Wicket.$('id6') != null;}.bind(this));return !wcall;
{code}

the actual format is 

if (condition) showIncrementally(); doAjaxCall();

with doAjaxCall() getting an onsuccess and onfailure listeners which call 
hideIncrementally().

the call to hideIncrementally() does not need to be if (condition) 
hideIncrementally() because those callbacks are only triggered if the condition 
was met in the first place - checked by wicket.ajax.call

> AbstractDefaultAjaxBehavior generates broken Javascript
> -------------------------------------------------------
>
>                 Key: WICKET-3513
>                 URL: https://issues.apache.org/jira/browse/WICKET-3513
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 1.4.16, 1.5-RC2
>         Environment: n/a
>            Reporter: Stijn de Witt
>              Labels: javascript
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior#generateCallbackScript is 
> generating Javascript code of the form:
> if (condition) {Wicket.hideIncrementally()} var wcall = <ajax call code>; 
> Wicket.showIncrementally(); 
> It should either be:
> if (condition) {Wicket.hideIncrementally(); var wcall = <ajax call code>; 
> Wicket.showIncrementally(); }
> (notice the moved closing brace of the if-block)
> or:
> if (condition) {Wicket.hideIncrementally()} var wcall = <ajax call code>; if 
> (condition) {Wicket.showIncrementally()}
> Any way, the calls to Wicket.hideIncrementally and Wicket.showIncrementally 
> should be balanced. Now they are not, which may trigger, in some 
> circumstances (when 'condition' == true) a call to showIncrementally when 
> there was never a call to hideIncrementally, disturbing the balance in such a 
> way that the busy indicator keeps spinning forever.
> Also see my related posts on the Wicket User List:
> Possible bug in org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
> http://apache-wicket.1842946.n4.nabble.com/Possible-bug-in-org-apache-wicket-ajax-AbstractDefaultAjaxBehavior-td3335256.html
> With kind regards,
> -Stijn

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to