You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Liam Clarke-Hutchinson <li...@steelsky.co.nz> on 2009/04/23 00:43:45 UTC

Registering 'global' Ajax listeners?

Hi,

I have  page with several child components, and several of the
children update themselves using Ajax. Is it possible for the page to
register an Ajax listener that is called on the Ajax events of the
children?

Regards,

Liam Clarke

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


Re: Registering 'global' Ajax listeners?

Posted by Liam Clarke-Hutchinson <li...@steelsky.co.nz>.
Thanks Peter, that looks like what I was after, albeit at an even
higher level. :)

On Fri, Apr 24, 2009 at 12:05 AM, Peter Ertl <pe...@gmx.org> wrote:
> Maybe these help...
>
> - you can override WebApplication.newAjaxRequestTarget(Page page)
> - you can use AjaxRequestTarget.addListener() to add listeners
>
>
>
> Am 23.04.2009 um 13:45 schrieb Liam Clarke-Hutchinson:
>
>> Hi Martin,
>>
>> Yeah, we've got a page that has an immediate child label that needs to
>> be refreshed on pretty much every Ajax request being generated by the
>> other children on the page..
>>
>> We were trying to avoid passing a reference to the label to the other
>> children's constructors, as it smells bad and makes it hard to test.
>>
>> Ultimately we've gone for the usual method of exposing an overrideable
>> method in the children for the parent to override where we can add the
>> label, but was just wondering if there was a way to get an event to
>> fire for the whole page - similar to how you can get DOM events
>> bubbling through various event handlers in the component hierachy.
>>
>>
>> Cheers,
>>
>> Liam Clarke
>>
>> On 4/23/09, Martin Funk <ma...@googlemail.com> wrote:
>>>
>>> Hi Liam,
>>>
>>> what is it that you'd like to achieve?
>>>
>>> On the server side, when executing protected abstract void
>>> respond(AjaxRequestTarget target);
>>> any component can be added to the target.
>>>
>>> mf
>>>
>>> Am 23.04.2009 um 00:43 schrieb Liam Clarke-Hutchinson:
>>>
>>>> Hi,
>>>>
>>>> I have  page with several child components, and several of the
>>>> children update themselves using Ajax. Is it possible for the page to
>>>> register an Ajax listener that is called on the Ajax events of the
>>>> children?
>>>>
>>>> Regards,
>>>>
>>>> Liam Clarke
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>
>
> ---------------------------------------------------------------------
> 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: Registering 'global' Ajax listeners?

Posted by Peter Ertl <pe...@gmx.org>.
Maybe these help...

- you can override WebApplication.newAjaxRequestTarget(Page page)
- you can use AjaxRequestTarget.addListener() to add listeners



Am 23.04.2009 um 13:45 schrieb Liam Clarke-Hutchinson:

> Hi Martin,
>
> Yeah, we've got a page that has an immediate child label that needs to
> be refreshed on pretty much every Ajax request being generated by the
> other children on the page..
>
> We were trying to avoid passing a reference to the label to the other
> children's constructors, as it smells bad and makes it hard to test.
>
> Ultimately we've gone for the usual method of exposing an overrideable
> method in the children for the parent to override where we can add the
> label, but was just wondering if there was a way to get an event to
> fire for the whole page - similar to how you can get DOM events
> bubbling through various event handlers in the component hierachy.
>
>
> Cheers,
>
> Liam Clarke
>
> On 4/23/09, Martin Funk <ma...@googlemail.com> wrote:
>> Hi Liam,
>>
>> what is it that you'd like to achieve?
>>
>> On the server side, when executing protected abstract void
>> respond(AjaxRequestTarget target);
>> any component can be added to the target.
>>
>> mf
>>
>> Am 23.04.2009 um 00:43 schrieb Liam Clarke-Hutchinson:
>>
>>> Hi,
>>>
>>> I have  page with several child components, and several of the
>>> children update themselves using Ajax. Is it possible for the page  
>>> to
>>> register an Ajax listener that is called on the Ajax events of the
>>> children?
>>>
>>> Regards,
>>>
>>> Liam Clarke
>>>
>>> ---------------------------------------------------------------------
>>> 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


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


Re: Registering 'global' Ajax listeners?

Posted by Liam Clarke-Hutchinson <li...@steelsky.co.nz>.
Hi Martin,

Yeah, we've got a page that has an immediate child label that needs to
be refreshed on pretty much every Ajax request being generated by the
other children on the page..

We were trying to avoid passing a reference to the label to the other
children's constructors, as it smells bad and makes it hard to test.

Ultimately we've gone for the usual method of exposing an overrideable
method in the children for the parent to override where we can add the
label, but was just wondering if there was a way to get an event to
fire for the whole page - similar to how you can get DOM events
bubbling through various event handlers in the component hierachy.


Cheers,

Liam Clarke

On 4/23/09, Martin Funk <ma...@googlemail.com> wrote:
> Hi Liam,
>
> what is it that you'd like to achieve?
>
> On the server side, when executing protected abstract void
> respond(AjaxRequestTarget target);
> any component can be added to the target.
>
> mf
>
> Am 23.04.2009 um 00:43 schrieb Liam Clarke-Hutchinson:
>
>> Hi,
>>
>> I have  page with several child components, and several of the
>> children update themselves using Ajax. Is it possible for the page to
>> register an Ajax listener that is called on the Ajax events of the
>> children?
>>
>> Regards,
>>
>> Liam Clarke
>>
>> ---------------------------------------------------------------------
>> 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: Registering 'global' Ajax listeners?

Posted by Martin Funk <ma...@googlemail.com>.
Hi Liam,

what is it that you'd like to achieve?

On the server side, when executing protected abstract void  
respond(AjaxRequestTarget target);
any component can be added to the target.

mf

Am 23.04.2009 um 00:43 schrieb Liam Clarke-Hutchinson:

> Hi,
>
> I have  page with several child components, and several of the
> children update themselves using Ajax. Is it possible for the page to
> register an Ajax listener that is called on the Ajax events of the
> children?
>
> Regards,
>
> Liam Clarke
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>