You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Vjeran Marcinko <vj...@tis.hr> on 2004/06/17 07:53:25 UTC

Drawback: [WAS Re: How to customize table cell base on the cell data?]

Actually, there is one minor lack of functionality in contrib:Table, at
least as I see it. Specifying columns values by columns String parameter in
a form of :
id:description:expression
is great timesaver, but the only minor drawback is that column value
expression is evaluated on row object, where it would be better that row
object is placed back into some page property (like "row" parameter of
TableRows) and expression can be called on page itself, thus calling some
page method calculateCurrentColumnValue() that do complex calculations based
on that row. Similar to Foreach capability.
I have such contrib:Table where each column value has some complex way of
presenting column value and that is best calcuated inside java code and not
template (separating presentation and logic).
I had 2 choices :
- to place row object back into page using contrib:TableRows and use
xxxBlock for each column (and there are many of them making template
cumbersome) where I would call such calculateCurrentColumnValue() method of
the page
- to wrap row objects inside some new class before giving it to
contrib:Table "source" parameter. This new class will have this
calculateCurrentColumnValue() which can be called from expression in source
String, because this new class instance is row object now

Of course, this is only minor drawback, nothing serious. It's just that
placing iterating value back into page/component is one of best things that
I experienced in Tapestry. Such way template is kept very clean since
complex logic is placed where it shoud be, in java classes.

-Vjeran


----- Original Message ----- 
From: "Ralph Churchill" <ch...@gmail.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Thursday, June 17, 2004 12:20 AM
Subject: Re: How to customize table cell base on the cell data?


> <span jwcid="xxxColumnValue@Block">
> <!-- insert stuff here... -->
> </span>
>
> Where "xxx" is the name of the column. It's a neat trick!
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org