You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Jered Myers <je...@maplewoodsoftware.com> on 2013/06/20 19:48:01 UTC

AjaxChannel Queues

I am having a few challenges with the AjaxChannel queuing up and 
interfering with actions a user is making while in ajax requests are in 
queue.  When my AbstractDefaultAjaxBehavior hits its respond method, it 
adds a JavaScript call to the target.  Does that JavaScript get executed 
before the next ajax request is release from the AjaxChannel queue?

In my example below, the user would be clicking the button fast enough 
to queue the AjaxChannel.  I need to know if the finishButtonWork 
function call would happen before or after the AjaxChannel releases the 
next ajax request from queue.

// HTML
<input type="button" onclick="callbackForBehvaior();"></input>

// JavaScript
callbackForBehavior = function() {
   Wicket.Ajax.ajax({blah});
}
getButtonDetails = function() {
     ...
     return buttonDetailsJSON;
}
finishButtonWork = function(json) {

}

// Java AbstractDefaultAjaxBehavior
protected void updateAjaxAttributes(AjaxRequestAttributes attribs){
         super.updateAjaxAttributes(attribs);

         // Call the function that sets up the parameters to pass back 
to the server.
         attribs.getDynamicExtraParameters().add("return 
getButtonDetails();");
}
protected void respond(AjaxRequestTarget target) {
     ...
     target.appendJavaScript("finishButtonWork(" + resultJSON + ");");
}

-- 
Jered Myers


Re: AjaxChannel Queues

Posted by Jered Myers <je...@maplewoodsoftware.com>.
Thanks!

On 06/20/2013 01:08 PM, Sven Meier wrote:
> The Javascript in the response is evaluated as part of the ajax call.
>
> >I need to know if the finishButtonWork function call would happen 
> before or after the AjaxChannel releases the next ajax request from 
> queue.
>
> Before.
>
> Sven
>
> On 06/20/2013 07:48 PM, Jered Myers wrote:
>> I am having a few challenges with the AjaxChannel queuing up and 
>> interfering with actions a user is making while in ajax requests are 
>> in queue.  When my AbstractDefaultAjaxBehavior hits its respond 
>> method, it adds a JavaScript call to the target. Does that JavaScript 
>> get executed before the next ajax request is release from the 
>> AjaxChannel queue?
>>
>> In my example below, the user would be clicking the button fast 
>> enough to queue the AjaxChannel.  I need to know if the 
>> finishButtonWork function call would happen before or after the 
>> AjaxChannel releases the next ajax request from queue.
>>
>> // HTML
>> <input type="button" onclick="callbackForBehvaior();"></input>
>>
>> // JavaScript
>> callbackForBehavior = function() {
>>   Wicket.Ajax.ajax({blah});
>> }
>> getButtonDetails = function() {
>>     ...
>>     return buttonDetailsJSON;
>> }
>> finishButtonWork = function(json) {
>>
>> }
>>
>> // Java AbstractDefaultAjaxBehavior
>> protected void updateAjaxAttributes(AjaxRequestAttributes attribs){
>>         super.updateAjaxAttributes(attribs);
>>
>>         // Call the function that sets up the parameters to pass back 
>> to the server.
>>         attribs.getDynamicExtraParameters().add("return 
>> getButtonDetails();");
>> }
>> protected void respond(AjaxRequestTarget target) {
>>     ...
>>     target.appendJavaScript("finishButtonWork(" + resultJSON + ");");
>> }
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: AjaxChannel Queues

Posted by Sven Meier <sv...@meiers.net>.
The Javascript in the response is evaluated as part of the ajax call.

 >I need to know if the finishButtonWork function call would happen 
before or after the AjaxChannel releases the next ajax request from queue.

Before.

Sven

On 06/20/2013 07:48 PM, Jered Myers wrote:
> I am having a few challenges with the AjaxChannel queuing up and 
> interfering with actions a user is making while in ajax requests are 
> in queue.  When my AbstractDefaultAjaxBehavior hits its respond 
> method, it adds a JavaScript call to the target. Does that JavaScript 
> get executed before the next ajax request is release from the 
> AjaxChannel queue?
>
> In my example below, the user would be clicking the button fast enough 
> to queue the AjaxChannel.  I need to know if the finishButtonWork 
> function call would happen before or after the AjaxChannel releases 
> the next ajax request from queue.
>
> // HTML
> <input type="button" onclick="callbackForBehvaior();"></input>
>
> // JavaScript
> callbackForBehavior = function() {
>   Wicket.Ajax.ajax({blah});
> }
> getButtonDetails = function() {
>     ...
>     return buttonDetailsJSON;
> }
> finishButtonWork = function(json) {
>
> }
>
> // Java AbstractDefaultAjaxBehavior
> protected void updateAjaxAttributes(AjaxRequestAttributes attribs){
>         super.updateAjaxAttributes(attribs);
>
>         // Call the function that sets up the parameters to pass back 
> to the server.
>         attribs.getDynamicExtraParameters().add("return 
> getButtonDetails();");
> }
> protected void respond(AjaxRequestTarget target) {
>     ...
>     target.appendJavaScript("finishButtonWork(" + resultJSON + ");");
> }
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org