Hi Josh,

Thanks for the correction. I will implement.

Cheers


-----Original Message-----
From: Josh Canfield <joshcanfi...@gmail.com>
Reply-to: "Tapestry users" <users@tapestry.apache.org>
To: Tapestry users <users@tapestry.apache.org>, r...@su3analytics.com
Subject: Re: Actionlinks with the same t:id
Date: Mon, 6 Dec 2010 09:09:30 -0800

> Thanks for the response. Using EventLink I need to have:
>
> private EventLink menuItem1, menuItem2, menuItem3....
>
> with t:id="menuItem1" etc in the tml. So still a declaration for each
> link in java and a different t:id each time but yes it does mean only
> one handler method.

This is incorrect. You only need the reference in your class if you
need to do something with the component object. You only need to
provide a t:id if you need to refer to it later. Having the <a
t:type="eventlink">, or <t:eventlink> is enough to get the component
embedded in your page.



public Object onMenuEvent(int context) {

... get new results per the context...

  return resultsZone.getBody();
}


with my menu like:


<li>
 <t:eventlink event="menuevent" context="literal:1" zone="resultsZone">...
</li>
<li>
 <t:eventlink event="menuevent" context="literal:2" zone="resultsZone">...
</li>

Josh

On Mon, Dec 6, 2010 at 7:16 AM, Richard Hill <r...@su3analytics.com> wrote:
>
> Hi Kris,
>
> Thanks for the response. Using EventLink I need to have:
>
> private EventLink menuItem1, menuItem2, menuItem3....
>
> with t:id="menuItem1" etc in the tml. So still a declaration for each
> link in java and a different t:id each time but yes it does mean only
> one handler method.
>
> Cheers
>
>
>
> -----Original Message-----
> From: Kristian Marinkovic <kristian.marinko...@porscheinformatik.at>
> Reply-to: "Tapestry users" <users@tapestry.apache.org>
> To: Tapestry users <users@tapestry.apache.org>
> Subject: Re: Actionlinks with the same t:id
> Date: Mon, 6 Dec 2010 12:22:38 +0100
>
> Use a EventLink instead and define a custom event.
>
> @Component(parameters= {"event=menu", "context=menuContext"}
> private EventLink link;
>
>
> somewhere else (a parent component):
>
> onMenu(....)
> {}
>
> The t:ids within a component/page have to be unique.
>
> g,
> kris
>
>
>
> Von:    Richard Hill <r...@su3analytics.com>
> An:     Tapestry users <users@tapestry.apache.org>
> Datum:  06.12.2010 12:15
> Betreff:        Actionlinks with the same t:id
>
>
>
>
> Hi,
>
> I have a menu, with 5 to 10 links, each of which I'd like to be an
> actionlink to trigger a zone update.
>
> I'd like to have just one event handler for the menu, something like:
>
>
> public Object onActionFromMenu(int context) {
>
> ... get new results per the context...
>
>   return resultsZone.getBody();
> }
>
>
> with my menu like:
>
>
> <li>
>  <t:actionlink t:id="menu" context="literal:1" zone="resultsZone">...
> </li>
> <li>
>  <t:actionlink t:id="menu" context="literal:2" zone="resultsZone">...
> </li>
> ...
>
>
> However Tapestry complains, saying that t:id should be unique. If t:id
> has to be unique, that means I have to have separate event handlers for
> each menu item, which is a little verbose.
>
> Is there a way of having multiple actionlinks in a page, each triggering
> the same event handler? This is also useful if I want to have the same
> link more than once in the page.
>
> Thanks
>
> Richard.
>
>
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

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




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

Reply via email to