hi Glenn,

i took a look at the current implementation of the ActionLink and it 
seems that the "id" attribute is only rendered if it is really needed (
in case of zones, for JavaScript event listener).

But if you call the getClientId() method of the ActionLink component
manually the "id" attribute will be rendered because tapestry assumes 
that you will need the id somewhere.

as an alternative you could write a Mixin that is attached to your 
ActionLinks ensuring the generation of the id attribute:

public class ForceIdMixin {
   @InjectContainer
   private ClientElement component;
 
   void afterRender() {
      component.getClientId();
   }
}

public class Page {
   @Component @MixinClasses(ForceIdMixin.class)
   private ActionLink link;

}

i hope this helps

g,
kris

P.S. you could also change your test cases :)





Glenn Sudduth <[EMAIL PROTECTED]> 
17.06.2008 21:15
Bitte antworten an
"Tapestry users" <users@tapestry.apache.org>


An
Tapestry users <users@tapestry.apache.org>
Kopie

Thema
Id not generated for actionlinks in grid ...







I upgraded my project to T5 v5.0.13 from .11 this morning. This was a
very smooth upgrade except for one issue which has caused some breakage
in my integration tests. 

This (slightly simplified) code in .11 ....

<t:grid
   source="foos"
   row="foo"
   model="model">
   <t:parameter name="editFooCell">
      <t:actionlink t:id="editFoo" context="foo.fooId"> Edit 
</t:actionlink>
   </t:parameter>
</t:grid>

... generates HTML anchor which includes an id ...

<a id="editFoo" href="/MyApp/managefoos.editfoo/1"> Edit </a>
<a id="editFoo_0" href="/MyApp/managefoos.editfoo/2"> Edit </a>
<a id="editFoo_1" href="/MyApp/managefoos.editfoo/3"> Edit </a>

However, .13 doesn't seem to ...

<a href="managefoos.editfoo/1">Edit</a>
<a href="managefoos.editfoo/2">Edit</a>

My tests were referencing these elements by id and now can't find them. 
How can I get them back?

Thanks,
--
Glenn 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to