Have not tried using a Map to store the +/- toggle button logic. Storing
information for all the objects in the collection in a Map in one instance
of my display component sounds like a workable solution. Thanks.
Ron Piterman <[EMAIL PROTECTED]>
Sent by: news <[EMAIL PROTECTED]>
07/06/2005 23:20
Please respond to "Tapestry users"
To: [email protected]
cc:
Subject: Re: Unique components within Foreach
I guess you have to store this +/- information somewhere.
It will probably be in the component, so you could create a Map member
in your component, and store this info there (or a list?), so, intead of
saving one value, you save the all.
When you press (+) (on the browser), you call a directLink, with a
parameter of the current value, and the listener method adds it to the
map. (-) will remove it...
don't forget to make it transient and override initialize() with setting
the map/list to null.
ציטוט Paul Grimwood:
> I have seen this problem arise before in this group discussion, but as
yet
> no one seems to have offered a solution.
>
> The problem: Declaring components within a Foreach block generates one
> instance of the enclosed component rather than multiple unique
instances.
>
> For example, if I have 3 pieces of equipment in an equipment list, using
> the template declaration listed below, i only get one instance of the
> DisplayEquipment component, rendered multiple times. The equipment info
is
> different in each rendering - as i would expect - but the problem arises
> because my component also has a boolean variable used to store logic as
to
> whether to display further owner information or not. When the
component/s
> is/are rendered a plus or minus symbol represents a link to open or
close
> company info respectively. Say i click on a plus symbol link in one of
the
> 3 rendered components in order to open company info for that piece of
> equipment alone, the info is opened for all 3 components, and all 3
links
> switch to the minus image, because they all appear to all share the same
> boolean variable. Is there a way to get around this strange behaviour?
>
> <span jwcid="@Foreach" source="ognl:equipment.equipments"
value="ognl:childEquipment" >
> <span jwcid="@DisplayEquipment"
equipmentModel="ognl:childEquipment" />
> </span>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]