You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Andris Rāmavs <og...@inbox.lv> on 2006/02/27 08:59:39 UTC

contrib:Table - multiple columns with links

Hi,

I need to generate a table with multiple columns of the same kind;
e.g.:

Date   User1    User2    User3
02/14    323.1     323.1    31.3
02/15    313.1     363.1    45.3
02/16    353.1     313.1    85.3  
Each of the cell values is a link that will show the details for that
particular measurement (for that user for that date).

For this, I am dynamically generating an ITableColumn array with a
column looking like this:

for (int i = 0; i < getUserCount(); i++) {
            final int userId = i;

            SimpleTableColumn column = new SimpleTableColumn("value",
false) {
                public int getUserId() {
                    return userId;
                }
            };
            column.setValueRendererSource(new
BlockTableRendererSource(new
ComponentAddress(getComponent("valueColumnValue"))));
            results.add(column); // add to ArrayList to be converted
to ITableColumn[]
}
The .html file contains a Block:
It seems to work so far.

But it feels like an ugly hack and that there must be a simpler,
better solution that I'm missing.

Anyone have any other suggestions on how to accomplish this better?

Thanks for any help -
Janis.