Hi, Perhaps I am not understanding your situation or perhaps my example failed to stimulate your creativity. ;-)
If you don't know the class, at the minumum the class should implement something that will spit out the column names, and the way to get the elements of each row. For instance, if your model classes all implemented a method that gave the Contrib table the column metadata it was looking for, it could return a runtime generated string that looks like this: "data0:ID:getUserDetails('USERGUID'),data1:Email:getUserDetails('EMAIL'),data2:First Name:getUserDetails('FIRSTNAME'),data3:Last Name:getUserDetails('LASTNAME')"; Or more abstractly, the string above is 3 of these, one for each column of data: "RowIdentifierForTheLoopToReference" + ":"+ "commonMethodForGettingColumnDisplayName()" +":" + "commonMethodForGettingDataValue()" The "RowIdentifierForTheLoopToReference" can be anything string, like "cat". The table will increment the name for each row (row 8 would be "cat8") So your data model class might have something like this? Public Abstract Class DataModelBaseClass { public String GetStringForContribTableColNames(); public Object GetData(String ColName); } I am out of coffee, so I'm going home now. Good luck! Dan On 10/31/06, ra <[EMAIL PROTECTED]> wrote:
Daniel Jue wrote: > > 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')"; > Sorry it doesn't help. As I wrote I don't know column names at development time. I don't know even the class name because model is created during runtime. I can give more details if it's not clear -- View this message in context: http://www.nabble.com/links-in-a-table-tf2548557.html#a7104516 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]