You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Stefan <st...@wammel.com> on 2015/07/22 11:44:58 UTC

zone.deferredZoneUpdate fires update events twice

 
Hi guys,

on some complex components i need zone-updates and make use of
t5/core/zone.deferredZoneUpdate(‚zoneElId', URI)  

My problem is that events.zone.update (and willUpdate & didUpdate) are fired twice.  
I need to listen on that event to re-install listeners to components in the refreshed zone.

I tried to track this down:  

1. t5.core.zone.deferredZoneUpdate will trigger ‚events.zone.refresh‘  

2. a listener on ‚events.zone.refresh‘ will call t5.core.ajax()  
and passes a function to trigger zone.update on success

3. t5.core.ajax() itself will call on success: pageinit.handlePartialPageRenderResponse(response, successHandler);  
pageinit.handlePartialPageRenderResponse then triggers ‚events.zone.update‘ the first time.  
After that it will call the passed onSuccess-handler which results in a double triggered zone.update event.


Did i made a mistake here?  
For me i fixed that with replacing t5.core.zone.deferredZoneUpdate() with t5.core.ajax().

(i’m using T5.4 b32)  



Regards,  
Stefan


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


Re: zone.deferredZoneUpdate fires update events twice

Posted by Stefan <li...@wammel.com>.
Hi Geoff,

thanks for your reply!
I personally preferred the use of listeners, but i’ll definitely give it a try.

What do you think about that double fired events?
I'll try to check this again to make sure this isn’t a bug.


My best,
Stefan


Am 24. Juli 2015 bei 03:03:32, Geoff Callender (geoff.callender.jumpstart@gmail.com) schrieb:
> Hi Stefan,
>  
> Rather than making your javascript depend on understanding Tapestry’s workings, perhaps  
> you can simply command things from the server-side? When the server-side responds to  
> the request with a zone, eg. ajaxResponseRenderer.addZone(zoneElld); could it also  
> respond with a callback commanding the listeners to refresh themselves? Eg. ajaxResponseRenderer.addCallback(makeCallbackToRefreshListeners()).  
>  
> If you need an example of this kind of callback, look in Modal.java in
>  
> http://jumpstart.doublenegative.com.au/jumpstart7/examples/javascript/modal/1  
>  
>  
> HTH,
>  
> Geoff
>  
> > On 22 Jul 2015, at 7:44 pm, Stefan wrote:
> >
> >
> > Hi guys,
> >
> > on some complex components i need zone-updates and make use of
> > t5/core/zone.deferredZoneUpdate(‚zoneElId', URI)
> >
> > My problem is that events.zone.update (and willUpdate & didUpdate) are fired twice.  
> > I need to listen on that event to re-install listeners to components in the refreshed  
> zone.
> >
> > I tried to track this down:
> >
> > 1. t5.core.zone.deferredZoneUpdate will trigger ‚events.zone.refresh‘
> >
> > 2. a listener on ‚events.zone.refresh‘ will call t5.core.ajax()
> > and passes a function to trigger zone.update on success
> >
> > 3. t5.core.ajax() itself will call on success: pageinit.handlePartialPageRenderResponse(response,  
> successHandler);
> > pageinit.handlePartialPageRenderResponse then triggers ‚events.zone.update‘  
> the first time.
> > After that it will call the passed onSuccess-handler which results in a double triggered  
> zone.update event.
> >
> >
> > Did i made a mistake here?
> > For me i fixed that with replacing t5.core.zone.deferredZoneUpdate() with t5.core.ajax().  
> >
> > (i’m using T5.4 b32)
> >
> >
> >
> > Regards,
> > Stefan
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
>  
>  


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


Re: zone.deferredZoneUpdate fires update events twice

Posted by Geoff Callender <ge...@gmail.com>.
Hi Stefan,

Rather than making your javascript depend on understanding Tapestry’s workings, perhaps you can simply command things from the server-side? When the server-side responds to the request with a zone, eg. ajaxResponseRenderer.addZone(zoneElld); could it also respond with a callback commanding the listeners to refresh themselves? Eg. ajaxResponseRenderer.addCallback(makeCallbackToRefreshListeners()).

If you need an example of this kind of callback, look in Modal.java in

	http://jumpstart.doublenegative.com.au/jumpstart7/examples/javascript/modal/1 <http://jumpstart.doublenegative.com.au/jumpstart7/examples/javascript/modal/1>

HTH,

Geoff

> On 22 Jul 2015, at 7:44 pm, Stefan <st...@wammel.com> wrote:
> 
>  
> Hi guys,
> 
> on some complex components i need zone-updates and make use of
> t5/core/zone.deferredZoneUpdate(‚zoneElId', URI)  
> 
> My problem is that events.zone.update (and willUpdate & didUpdate) are fired twice.  
> I need to listen on that event to re-install listeners to components in the refreshed zone.
> 
> I tried to track this down:  
> 
> 1. t5.core.zone.deferredZoneUpdate will trigger ‚events.zone.refresh‘  
> 
> 2. a listener on ‚events.zone.refresh‘ will call t5.core.ajax()  
> and passes a function to trigger zone.update on success
> 
> 3. t5.core.ajax() itself will call on success: pageinit.handlePartialPageRenderResponse(response, successHandler);  
> pageinit.handlePartialPageRenderResponse then triggers ‚events.zone.update‘ the first time.  
> After that it will call the passed onSuccess-handler which results in a double triggered zone.update event.
> 
> 
> Did i made a mistake here?  
> For me i fixed that with replacing t5.core.zone.deferredZoneUpdate() with t5.core.ajax().
> 
> (i’m using T5.4 b32)  
> 
> 
> 
> Regards,  
> Stefan
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>