I recently found a solution due to some help on this mailing list.
Here's what we came up with. It displays a table of people, and the extent of people details are not known until runtime (i.e. should we display the first name, last name, email, etc) In the page file: <component id="table" type="Contrib:Table"> <binding name="source" value="users"/> <binding name="columns" value="tableColumns"/> <binding name="columnsClass" value="literal:title"/> <binding name="pageSize" value="10"/> </component> In your class for that page have this method: public String getTableColumns() { //For reference //Column id:Column Title:ognl expression //value="literal:id, firstName:First name:name.firstName, // lastName:name.lastName, telNo"/> return "data0:ID:getUserDetails('USERGUID'),data1:Email:getUserDetails('EMAIL'),data2:First Name:getUserDetails('FIRSTNAME'),data3:Last Name:getUserDetails('LASTNAME')"; } As you can see, the string that defines the columns, along this their display names and "ID"s for the loop, can be generated at runtime. I thought that was really nifty. As for the links, lets say you wanted the links to be on the user's email. Add this to the page file: <component id="data1ColumnValue" type="Block"/> <component id="emailLink" type="DirectLink"> <binding name="listener" value="listener:onShowDetails"/> <binding name="parameters" value="components.table.tableRow.getUserDetails('EMAIL')"/> </component> <component id="emailLinkDisplay" type="Insert"> <binding name="value" value="components.table.tableRow.getUserDetails('EMAIL')"/> </component> Note that getUserDetails() is my own function that a User object posesses. It just provides a way to look up details stored in a Map object. I'm using the db column names as the keys for the data. Now my html looks like this: <table border="1" jwcid="table"> <tr><th>id</th><th>email</th></tr> <tr><td>1</td> <td jwcid="data1ColumnValue"> <a href="" jwcid="emailLink"> <span jwcid="emailLinkDisplay">[EMAIL PROTECTED]</span> </a> </td> </tr> </table> Back in the page Class, you'll need a listener and the page you want to return: @InjectPage("ShowDetails") public abstract ShowDetails getUserDetailsPage(); public ShowUserDetails onShowDetails(String email) { System.out.println("Showing details for " + email); getUserDetailsPage().setViewUserWithEmail(email); return getUserDetailsPage(); } Hope this helps. Dan On 10/31/06, ra <[EMAIL PROTECTED]> wrote:
I'd like display links in a table, but ... column names are unknown at the development time I'm new to tapestry and don't what is the best solution. What I found is I can override method getValueRender in i.e. SimpleTableRenderer and return somehow PageLink instance but it's abstract class and have no idea how to do it -- View this message in context: http://www.nabble.com/links-in-a-table-tf2548557.html#a7103183 Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- 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]