You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Pranav kacholia <pr...@gmail.com> on 2011/09/28 12:24:43 UTC

Divide an Ajax request into two parts

Hi All, 

Suppose i have a textfield with and oncomponentchange behavior which is
being used to do a search. 

Now the search can be done in two ways, say 1 method is faster than the
other. 
The searrch results are displayed vide ajax in a table. 

Is there anyway to fire two consecutive ajax requests?

So when the textfield is updated, first the search is done using method 1,
the results table is updated. 
If the textfield is updated further within a certain interval then the cycle
restarts.
If the textfield is not updated, a second ajax request is made after an
interval. This does the search using method 2, and the new results are
appended to the table at the end of the results for search 1. 

The advantage of using this method is that 95% of the time the search will
yield results using search method 1 so hence it should not be slowed down by
having to do both the searches and then joining the two sets and displaying
the results together.

Thanks.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Divide-an-Ajax-request-into-two-parts-tp3850614p3850614.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Divide an Ajax request into two parts

Posted by Pranav kacholia <pr...@gmail.com>.
Yeah, that sounds like a synchronization headache.... 

i guess another way of phrasing this is whether there is anyway of making an
AjaxUpdate non-blocking. 
as data is available, it will constantly update. 
Be very useful for searches

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Divide-an-Ajax-request-into-two-parts-tp3850614p3850697.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Divide an Ajax request into two parts

Posted by Martin Grigorov <mg...@apache.org>.
Use OnChangeAjaxBehavior to fire request to method 1 and
AbstractAjaxTimerBehavior for method 2.
Override their #getChannel() method to return different name so they
are not queued at the client.

Have fun with synchronizing them...

On Wed, Sep 28, 2011 at 12:24 PM, Pranav kacholia
<pr...@gmail.com> wrote:
> Hi All,
>
> Suppose i have a textfield with and oncomponentchange behavior which is
> being used to do a search.
>
> Now the search can be done in two ways, say 1 method is faster than the
> other.
> The searrch results are displayed vide ajax in a table.
>
> Is there anyway to fire two consecutive ajax requests?
>
> So when the textfield is updated, first the search is done using method 1,
> the results table is updated.
> If the textfield is updated further within a certain interval then the cycle
> restarts.
> If the textfield is not updated, a second ajax request is made after an
> interval. This does the search using method 2, and the new results are
> appended to the table at the end of the results for search 1.
>
> The advantage of using this method is that 95% of the time the search will
> yield results using search method 1 so hence it should not be slowed down by
> having to do both the searches and then joining the two sets and displaying
> the results together.
>
> Thanks.
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Divide-an-Ajax-request-into-two-parts-tp3850614p3850614.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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