Send multizone update from embedded component

View: New views
4 Messages — Rating Filter:   Alert me  

Send multizone update from embedded component

by lmhill :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have a component with a zone in it. Inside the zone is an embedded component which also contains a zone. The main zone is a customer detail page, while the inner component shows a list of contacts and has a link to mark one as the primary contact. The customer details include the primary contact name and phone number if one is selected.

I cannot find a way to get both the detail zone and the embedded contacts zone to update when selecting a primary contact. I tried using multizone updates, but the embedded component cannot update a zone it does not contain.

How do I fire an event on a component from an embedded component?

Re: Send multizone update from embedded component

by Ulrich Stärk :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

What I do is have the enclosed component trigger an event. That event returns a MultiZoneUpdate
object that I handle in the event callback and add the enclosed component to. I then return a
MultiZoneUpdate object containing both the ids and bodys of the two components to be updated from
the event handler in the enclosed component. looks like this:

parent component (update some navigation pane):

Object onUpdateNavigation()
{
     if (request.isXHR())
         return new MultiZoneUpdate("navigationZone", navigationZone.getBody());

     return null;
}

enclosed component:

@CommitAfter
Object onSuccess()
{
     session.saveOrUpdate(value);

     ComponentEventCallback<Object> callback = new ComponentEventCallback<Object>() {

         public boolean handleResult(Object result)
         {
             update = (MultiZoneUpdate) result;

             return false;
         }

     };

     componentResources.triggerEvent("updateNavigation", null, callback);

     if(request.isXHR())
         return update.add(zoneId, componentResources.getComponent());

     return null;
}

HTH,

Uli

Am 02.11.2009 19:35 schrieb lmhill:

> I have a component with a zone in it. Inside the zone is an embedded
> component which also contains a zone. The main zone is a customer detail
> page, while the inner component shows a list of contacts and has a link to
> mark one as the primary contact. The customer details include the primary
> contact name and phone number if one is selected.
>
> I cannot find a way to get both the detail zone and the embedded contacts
> zone to update when selecting a primary contact. I tried using multizone
> updates, but the embedded component cannot update a zone it does not
> contain.
>
> How do I fire an event on a component from an embedded component?

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


Re: Send multizone update from embedded component

by lmhill :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Ulrich,

Your approach solved the issue of doing the multizoneupdates across the components. Now I am seeing some errors popping up:

Ajax Zone 'childComponentZone' does not have an associated Tapestry.ZoneManager object.

Client exception processing response: TypeError: e is null

Any idea what is causing these, or how to fix the problem?

Re: Send multizone update from embedded component

by Howard Lewis Ship :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I think if you have an outer zone that contains an inner zone and you
try to update both of them in one go, it's just not going to work.
Updating the outer zone "rips out" the inner zone (it's div is garbage
collected). That leaves you with a reference to a div that no longer
exists.

On Thu, Nov 5, 2009 at 7:24 AM, lmhill <lancemhill@...> wrote:

>
> Hi Ulrich,
>
> Your approach solved the issue of doing the multizoneupdates across the
> components. Now I am seeing some errors popping up:
>
> Ajax Zone 'childComponentZone' does not have an associated
> Tapestry.ZoneManager object.
>
> Client exception processing response: TypeError: e is null
>
> Any idea what is causing these, or how to fix the problem?
> --
> View this message in context: http://old.nabble.com/Send-multizone-update-from-embedded-component-tp26157769p26215758.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>



--
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

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