You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Joost Schouten (ml)" <jo...@jsportal.com> on 2010/12/03 12:52:31 UTC
Re: dynamic component id?
It sounds like you are confusing the t:id with the html dom id. I
think you are looking for:
<t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
<t:loop source="startCals" value="currentStartCal">
<p t:id="yourComponentId" id="${index}" t:type="calendar/timeSlot"/>
</t:loop>
</t:container>
Cheers,
Joost
On 3/12/10 12:54 PM, Christian Koller wrote:
> I have the following template:
>
> <t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
> <t:loop source="startCals" value="currentStartCal">
> <p t:id="prop:index" t:type="calendar/timeSlot"/>
> </t:loop>
> </t:container>
>
> But Tapestry calls out:
> Component id 'prop:index' is not valid; component ids must be valid Java identifiers: start with a letter, and consist of letters, numbers and underscores.
>
> Is it not possible to use a property as id?
>
> If I use a literal as the id, then it works, but then all the generated timeSlot components within the loop will have the same id.
> If I use afterwards the persist annotation within the timeSlot component all the generated timeSlots share this session value because the id is the same.
>
> Any ideas how to solve this?
> Thank you
> chris
> ---------------------------------------------------------------------
> 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
Re: dynamic component id?
Posted by Antonio Fernández <am...@gmail.com>.
Hi !
You could try with ...
<t:loop>
<t:calendar.timeSlot t:id="myTimeSlot" />
</t:loop>
( TimeSlot.tml )
<p id="${myClientId}" />
...this clientId property is generated in the Java.Side with the following
method ( at SetupRender )
( TimeSlot.java )
@Property
private String myClientId;
@Inject
private ComponentResources componentResources;
@Inject
private RenderSupport renderSupport;
@SetupRender
void setupRender() {
myClientId = renderSupport.allocateClientId(componentResources);
}
... and you will have a sequence of DOM IDs generated : "myTimeSlot_1",
"myTimeSlot_2", ....
That´s all ,
Best Regards,
--
Antonio Miguel Fernández Rodríguez
Jaraxa Software, SL
Administrator, Software analyst
Cel. +34 607 78 86 85
www.jaraxa.com
El 03/12/2010 12:52, Joost Schouten (ml) escribió:
> It sounds like you are confusing the t:id with the html dom id. I
> think you are looking for:
>
> <t:container
> xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
> <t:loop source="startCals" value="currentStartCal">
> <p t:id="yourComponentId" id="${index}" t:type="calendar/timeSlot"/>
> </t:loop>
> </t:container>
>
> Cheers,
> Joost
>
>
>
> On 3/12/10 12:54 PM, Christian Koller wrote:
>> I have the following template:
>>
>> <t:container
>> xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
>> <t:loop source="startCals" value="currentStartCal">
>> <p t:id="prop:index" t:type="calendar/timeSlot"/>
>> </t:loop>
>> </t:container>
>>
>> But Tapestry calls out:
>> Component id 'prop:index' is not valid; component ids must be valid
>> Java identifiers: start with a letter, and consist of letters,
>> numbers and underscores.
>>
>> Is it not possible to use a property as id?
>>
>> If I use a literal as the id, then it works, but then all the
>> generated timeSlot components within the loop will have the same id.
>> If I use afterwards the persist annotation within the timeSlot
>> component all the generated timeSlots share this session value
>> because the id is the same.
>>
>> Any ideas how to solve this?
>> Thank you
>> chris
>> ---------------------------------------------------------------------
>> 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
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: dynamic component id?
Posted by Kristian Marinkovic <kr...@porscheinformatik.at>.
i guess it is about the dynamically generated id of the html element ...
the component should implement the interface ClientElement.
If it does you can call the method getClientId to obtain the id that is
used in the generated html.
g,
kris
Von: Everton Agner <to...@gmail.com>
An: Tapestry users <us...@tapestry.apache.org>
Datum: 03.12.2010 12:57
Betreff: Re: dynamic component id?
I believe he didn't misunderstood... the real problem is "which approach
should he get to work with dynamic components?".
Actually, I didn't need to use this yet but always wondered too.
_______________________
Everton Agner Ramos
2010/12/3 Joost Schouten (ml) <jo...@jsportal.com>
> It sounds like you are confusing the t:id with the html dom id. I think
> you are looking for:
>
>
> <t:container xmlns:t="
http://tapestry.apache.org/schema/tapestry_5_1_0.xsd
> ">
> <t:loop source="startCals" value="currentStartCal">
> <p t:id="yourComponentId" id="${index}"
> t:type="calendar/timeSlot"/>
> </t:loop>
> </t:container>
>
> Cheers,
> Joost
>
>
>
>
> On 3/12/10 12:54 PM, Christian Koller wrote:
>
>> I have the following template:
>>
>> <t:container xmlns:t="
>> http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
>> <t:loop source="startCals" value="currentStartCal">
>> <p t:id="prop:index" t:type="calendar/timeSlot"/>
>> </t:loop>
>> </t:container>
>>
>> But Tapestry calls out:
>> Component id 'prop:index' is not valid; component ids must be valid
Java
>> identifiers: start with a letter, and consist of letters, numbers and
>> underscores.
>>
>> Is it not possible to use a property as id?
>>
>> If I use a literal as the id, then it works, but then all the generated
>> timeSlot components within the loop will have the same id.
>> If I use afterwards the persist annotation within the timeSlot
component
>> all the generated timeSlots share this session value because the id is
the
>> same.
>>
>> Any ideas how to solve this?
>> Thank you
>> chris
>> ---------------------------------------------------------------------
>> 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
>
>
Re: dynamic component id?
Posted by Everton Agner <to...@gmail.com>.
I believe he didn't misunderstood... the real problem is "which approach
should he get to work with dynamic components?".
Actually, I didn't need to use this yet but always wondered too.
_______________________
Everton Agner Ramos
2010/12/3 Joost Schouten (ml) <jo...@jsportal.com>
> It sounds like you are confusing the t:id with the html dom id. I think
> you are looking for:
>
>
> <t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd
> ">
> <t:loop source="startCals" value="currentStartCal">
> <p t:id="yourComponentId" id="${index}"
> t:type="calendar/timeSlot"/>
> </t:loop>
> </t:container>
>
> Cheers,
> Joost
>
>
>
>
> On 3/12/10 12:54 PM, Christian Koller wrote:
>
>> I have the following template:
>>
>> <t:container xmlns:t="
>> http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
>> <t:loop source="startCals" value="currentStartCal">
>> <p t:id="prop:index" t:type="calendar/timeSlot"/>
>> </t:loop>
>> </t:container>
>>
>> But Tapestry calls out:
>> Component id 'prop:index' is not valid; component ids must be valid Java
>> identifiers: start with a letter, and consist of letters, numbers and
>> underscores.
>>
>> Is it not possible to use a property as id?
>>
>> If I use a literal as the id, then it works, but then all the generated
>> timeSlot components within the loop will have the same id.
>> If I use afterwards the persist annotation within the timeSlot component
>> all the generated timeSlots share this session value because the id is the
>> same.
>>
>> Any ideas how to solve this?
>> Thank you
>> chris
>> ---------------------------------------------------------------------
>> 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
>
>