Title: Re: [Wicket-user] ListView: Rendering table row id attribute
Hi Karl,

I thought it will be much easier if I use row<index> (or may be I 'm wrong) instead of retrieving 'tr' element. In real situation I 'm going to use it against a nested table and use _javascript_ to toggle (hide/visible) for each row within the nested table and the table below it. Having said that I use row<index> to 'handle' the messy table layout.

Thanks guys, its been very helpful now I got it running.


Cheers,
Michael



Karl-Erik R�nsen <[EMAIL PROTECTED]> wrote:

Why do you need to set an id for each row? Instead you can set an id for the table element and call:

var myRow = document.getElementById( “tabl eId” ).getElementsByTagName( “tr” )[indexOfRowYouWant];

Karl-Erik


On 13-03-06 12:24, "Dirk Markert" <[EMAIL PROTECTED]> wrote:

Hi Michael,
 
you need an AttributeModifier. Something like
 
protected void populateItem(final ListItem listItem) {
    add(new Label("name","Scooby").new AttributeModifier("id", ..,
     new Model("row" + listItem.getIndex()));
}
 
Dirk

 
2006/3/13, Michael K <[EMAIL PROTECTED]>:
Hi,

I want to be able to render id="row<count>" attribute when using ListView. I need it to code _javascript_ using getElementById(). Please find the examples below:

Html code:
---------------
<table>
<tr wicket:id = "rowToRender" id="row0">
    <td><span wicket:id="name">name</span></td>
</tr>
<tr wicket:id = "rowToRender" id="row1">
    <td><span wicket:id="name">name</span></td>
</tr>
<tr wicket:id = "rowToRender" id="row2">
    <td><span wicket:id="name">name</span></td>
</tr>
</table>


Java code:
---------------
add(new ListView("rowToRender",someArrayList){
   
protected void populateItem(final ListItem listItem) {
    add(new Label("name","Scooby");
}

});

Has anyone done this? Any help wo uld be greatly appreciated.

BTW, I 'm using Wicket 1.1.1.


Thanks in Advance.


--Michael



Yahoo! Mail
Bring photos to life! New PhotoMail  <http://pa.yahoo.com/*http://us.rd.yahoo.com/evt=39174/*http://photomail.mail.yahoo.com> makes sharing a breeze.






Relax. Yahoo! Mail virus scanning helps detect nasty viruses!

Reply via email to