You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Rich M <ri...@moremagic.com> on 2011/05/13 19:06:46 UTC

Updating only specific divs in Zone update

Hi,

I'm trying to put together an interactive page with multiple components, 
where each component can go through event/actions.

For example, two components might be account details and reports. In 
account details the initial view is a display of your basic fields and 
their values, but if you select an Edit button, the component will 
change to display a bean edit form.

The challenge I am facing is, when the Edit button is selected, to only 
update the display of the account details component and not alter the 
display of the rest of the page.

At the moment, I have all of the components contained on the page in a 
single Zone. From each component I use event callbacks to call a method 
on the containing Page that will return the zone for the component to 
update in events/actions.

This does not accomplish what I want, as each update call to the 
zone.getBody() will re-render all of the components at once, not just 
the account details.

Alternately, I tried writing a self-contained zone within each 
component, but when I return that on event/action methods from a 
component, it then replaces the rendering of the page with an updated 
rendering of just that component.

I have read about the 't-zone-update' css-class that can be used on a 
DIV within a Zone to isolate the content that actually gets updated, but 
I can't see how that will get me to where I want. Any guidance would be 
much appreciated.

Thanks,
Rich

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


Re: Updating only specific divs in Zone update

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Fri, 13 May 2011 14:49:47 -0300, Rich M <ri...@moremagic.com> wrote:

> I'm sorry, I'm not sure I fully understand how that would work. Wouldn't  
> that re-render all the other zones as well? I'm trying to isolate just  
> one of the components and not update the other ones.

No. You just add to the MultiZoneUpdate object the zones you want to  
update. Please read its documentation.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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


Re: Updating only specific divs in Zone update

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Fri, 13 May 2011 14:06:46 -0300, Rich M <ri...@moremagic.com> wrote:

> Hi,

Hi!

Use multiple zones instead of a single one and return a MultiZoneUpdate in  
your event handler method.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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


Re: Updating only specific divs in Zone update

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Tue, 17 May 2011 14:27:42 -0300, Rich M <ri...@moremagic.com> wrote:

> In my case, I have each Component using the triggerEvent method of  
> Component Resources with a Callback to return the proper  
> MultiZoneUpdate. I guess it was hard for me to conceptually understand  
> why I'd need a MultiZoneUpdate to update just a single Zone in the way I  
> wanted, but it works.

You don't need a MultiZoneUpdate to update a single zone. What I  
understood from your original problem was that you had a large zone and  
wanted to update parts of it, so I suggested using more zones and  
MultiZoneUpdate when you need to update more than once at the same time.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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


Re: Updating only specific divs in Zone update

Posted by Rich M <ri...@moremagic.com>.
Thanks, I suppose I should have responded after Thiago mentioned the 
MultiZoneUpdate a few days back, which did solve the problem for me.

In my case, I have each Component using the triggerEvent method of 
Component Resources with a Callback to return the proper 
MultiZoneUpdate. I guess it was hard for me to conceptually understand 
why I'd need a MultiZoneUpdate to update just a single Zone in the way I 
wanted, but it works.

Component

public Object returnZone(){
         final Object[] returnObject = new Object[]{null};
         Object[] context = new Object[]{zone};

         cr.triggerEvent("TriggerZoneUpdate",
                 context,
                 new ComponentEventCallback() {
                         public boolean handleResult(final Object result) {
                             if (result != null) {
                                 returnObject[0] = result;
                             }

                             return result != null;
                         }
                 });

         return returnObject[0];
}

Containing Page

public Object onTriggerZoneUpdate(Zone zoneForUpdate){
         return new MultiZoneUpdate(zoneForUpdate.getClientId(), 
zoneForUpdate);
}

On 05/17/2011 12:23 PM, Mark wrote:
> You probably want to build a multizone update to update just the necessary
> zones.  Here is a snippet of some of my code that updates zones only if they
> are visible in that particular context:
>
>     public MultiZoneUpdate getPriceMultiZoneUpdate() {
>
>          MultiZoneUpdate update = new MultiZoneUpdate("totalPriceZone",
> totalPriceZone);
>
>          if(isSubtotalVisible()) {
>
>              update = update.add("subtotalZone", subtotalZone);
>
>          }
>
>
>
>          if(isDiscountVisible()) {
>
>              update = update.add("totalDiscountsZone", totalDiscountsZone);
>
>          }
>
>
>
>          if(isSalesTaxVisible()) {
>
>              update = update.add("totalSalesTaxZone", totalSalesTaxZone);
>
>          }
>
>
>
>          if(isFulfillmentFeeVisible()) {
>
>              update = update.add("totalFulfillmentFeeZone",
> totalFulfillmentFeeZone);
>
>          }
>
>
>          return update;
>
>
>
>
>      }
>


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


Re: Updating only specific divs in Zone update

Posted by Mark <ma...@xeric.net>.
You probably want to build a multizone update to update just the necessary
zones.  Here is a snippet of some of my code that updates zones only if they
are visible in that particular context:

   public MultiZoneUpdate getPriceMultiZoneUpdate() {

        MultiZoneUpdate update = new MultiZoneUpdate("totalPriceZone",
totalPriceZone);

        if(isSubtotalVisible()) {

            update = update.add("subtotalZone", subtotalZone);

        }



        if(isDiscountVisible()) {

            update = update.add("totalDiscountsZone", totalDiscountsZone);

        }



        if(isSalesTaxVisible()) {

            update = update.add("totalSalesTaxZone", totalSalesTaxZone);

        }



        if(isFulfillmentFeeVisible()) {

            update = update.add("totalFulfillmentFeeZone",
totalFulfillmentFeeZone);

        }


        return update;




    }

Re: Updating only specific divs in Zone update

Posted by Geoff Callender <ge...@gmail.com>.
The links have been replaced by:

	AJAX Filter CRUD:	http://jumpstart.doublenegative.com.au/jumpstart/previews/ajaxfiltercrud/persons
	AJAX Components CRUD:	http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/componentscrud/persons


On 16/05/2011, at 8:57 AM, Geoff Callender wrote:

> Try these:
> 
> 	AJAX Filter CRUD:	http://jumpstart.doublenegative.com.au/jumpstart/examples/ajaxfiltercrud
> 	AJAX Components CRUD:	http://jumpstart.doublenegative.com.au/jumpstart/examples/ajaxcomponentscrud
> 
> Cheers,
> 
> Geoff
> 
> On 14/05/2011, at 3:06 AM, Rich M wrote:
> 
>> Hi,
>> 
>> I'm trying to put together an interactive page with multiple components, where each component can go through event/actions.
>> 
>> For example, two components might be account details and reports. In account details the initial view is a display of your basic fields and their values, but if you select an Edit button, the component will change to display a bean edit form.
>> 
>> The challenge I am facing is, when the Edit button is selected, to only update the display of the account details component and not alter the display of the rest of the page.
>> 
>> At the moment, I have all of the components contained on the page in a single Zone. From each component I use event callbacks to call a method on the containing Page that will return the zone for the component to update in events/actions.
>> 
>> This does not accomplish what I want, as each update call to the zone.getBody() will re-render all of the components at once, not just the account details.
>> 
>> Alternately, I tried writing a self-contained zone within each component, but when I return that on event/action methods from a component, it then replaces the rendering of the page with an updated rendering of just that component.
>> 
>> I have read about the 't-zone-update' css-class that can be used on a DIV within a Zone to isolate the content that actually gets updated, but I can't see how that will get me to where I want. Any guidance would be much appreciated.
>> 
>> Thanks,
>> Rich
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>> 
> 


Re: Updating only specific divs in Zone update

Posted by Geoff Callender <ge...@gmail.com>.
Try these:

	AJAX Filter CRUD:	http://jumpstart.doublenegative.com.au/jumpstart/examples/ajaxfiltercrud
	AJAX Components CRUD:	http://jumpstart.doublenegative.com.au/jumpstart/examples/ajaxcomponentscrud

Cheers,

Geoff

On 14/05/2011, at 3:06 AM, Rich M wrote:

> Hi,
> 
> I'm trying to put together an interactive page with multiple components, where each component can go through event/actions.
> 
> For example, two components might be account details and reports. In account details the initial view is a display of your basic fields and their values, but if you select an Edit button, the component will change to display a bean edit form.
> 
> The challenge I am facing is, when the Edit button is selected, to only update the display of the account details component and not alter the display of the rest of the page.
> 
> At the moment, I have all of the components contained on the page in a single Zone. From each component I use event callbacks to call a method on the containing Page that will return the zone for the component to update in events/actions.
> 
> This does not accomplish what I want, as each update call to the zone.getBody() will re-render all of the components at once, not just the account details.
> 
> Alternately, I tried writing a self-contained zone within each component, but when I return that on event/action methods from a component, it then replaces the rendering of the page with an updated rendering of just that component.
> 
> I have read about the 't-zone-update' css-class that can be used on a DIV within a Zone to isolate the content that actually gets updated, but I can't see how that will get me to where I want. Any guidance would be much appreciated.
> 
> Thanks,
> Rich
> 
> ---------------------------------------------------------------------
> 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