You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Elin <po...@gmail.com> on 2010/08/19 20:49:04 UTC

Events and multizone update

I have a custom component based on an "ajaxformloop" that displays rows with
a delete buttom for them.

I need to update several zones afer deleting a row from the ajaxformloop and
cant find a way to do it. From here i have some questions about events (im
sorry im starting with tapestry and im a bit newbie)


- Since "onRemoveRow" event can only return void (cant return a
multizoneupdate), would be possible to capture when i delete a row and
update several zones from it?

- Is it possible to generate custom events on my custom components so i can
capture them into the pages i insert them into?

If you link me examples where i can see this and analize them it would be
enough. I couldnt find any by myself.

Thx in advance.
-- 
View this message in context: http://tapestry.1045711.n5.nabble.com/Events-and-multizone-update-tp2641385p2641385.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Events and multizone update

Posted by Josh Canfield <jo...@gmail.com>.
> - Since "onRemoveRow" event can only return void (cant return a
> multizoneupdate), would be possible to capture when i delete a row and
> update several zones from it?

You can only return a multizoneupdate if you are inside of an ajax
request. If you are using an eventlink/actionlink then you need to add
the zone parameter with the client id of one of the zones you are
going to update (has to be a zone that exists on the page for the link
to get setup properly on the client)

<t:zone t:id="zone1" id="zone1">
    ${now}
</t:zone>

<t:zone t:id="zone2" id="zone2">
    ${last}
</t:zone>

<t:eventlink event="rotate" zone="zone1">Rotate</t:eventlink>


    MultiZoneUpdate onRotate() {
        _last = _now;
        _now = new Date();
        return new MultiZoneUpdate("zone1",
_zone1.getBody()).add("zone2", _zone2.getBody());
    }


Josh

On Thu, Aug 19, 2010 at 11:49 AM, Elin <po...@gmail.com> wrote:
>
> I have a custom component based on an "ajaxformloop" that displays rows with
> a delete buttom for them.
>
> I need to update several zones afer deleting a row from the ajaxformloop and
> cant find a way to do it. From here i have some questions about events (im
> sorry im starting with tapestry and im a bit newbie)
>
>
> - Since "onRemoveRow" event can only return void (cant return a
> multizoneupdate), would be possible to capture when i delete a row and
> update several zones from it?
>
> - Is it possible to generate custom events on my custom components so i can
> capture them into the pages i insert them into?
>
> If you link me examples where i can see this and analize them it would be
> enough. I couldnt find any by myself.
>
> Thx in advance.
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/Events-and-multizone-update-tp2641385p2641385.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
--
http://www.bodylabgym.com - a private, by appointment only, one-on-one
health and fitness facility.
--
http://www.ectransition.com - Quality Electronic Cigarettes at a
reasonable price!
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

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


Re: Events and multizone update

Posted by Elin <po...@gmail.com>.
Thx a lot. Thats all i needed :)
-- 
View this message in context: http://tapestry.1045711.n5.nabble.com/Events-and-multizone-update-tp2641385p2641538.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Events and multizone update

Posted by zozul <zo...@gmail.com>.

Elin wrote:
> 
> I need to update several zones afer deleting a row from the ajaxformloop
> and cant find a way to do it. 
> 
> - Since "onRemoveRow" event can only return void (cant return a
> multizoneupdate), would be possible to capture when i delete a row and
> update several zones from it?
> 

Use an actionlink inside ajaxformloop, at least i would do this this way.

Example:

        <div t:type="ajaxformloop" t:id="testlist1" source="testlist"
encoder="encoder" value="test">
            <t:textfield t:id="text" value="test.text"/>
            <t:actionlink t:id="delete" context="test.id"
t:zone="zone1">delete</t:actionlink>
        </div>

And in java class:

public Object onActionFromDelete(Integer id) {
        /*do delete here*/
        return new MultiZoneUpdate("zone1", zone1).add("zone2", zone2);
    }


Elin wrote:
> 
> - Is it possible to generate custom events on my custom components so i
> can capture them into the pages i insert them into?
> 

ZoneUpdater mixin is easiest way to go. With adding few words to the .tml
you can get great results, and it is great basis to extend it to your needs.
Some examplar usage of this is:

<select t:type="select" value="selectedItem" t:model="selectionModel"
t:mixins="zoneUpdater" 
t:zone="zone1" t:event="changeOfItem" t:clientEvent="change"
t:encoder="encoder"/>

in java:
public Object onChangeOfItem(String value) {
        /*any server action here*/
        return zone1.getBody();
    }

and you get ajax select

Hope it helps
-- 
View this message in context: http://tapestry.1045711.n5.nabble.com/Events-and-multizone-update-tp2641385p2641498.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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