You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Tian-Jian \"Tai-ming\" Jiang@IIS.SINICA" <tm...@iis.sinica.edu.tw> on 2006/05/19 20:41:48 UTC

How to Customize contrib.TableView for TableColumn and TableView?

Dear all,
	If I would like to put two properties into one table column, how 
should I customize contrib:Table to do so? It's something like your 
example of Name.firstName/Name.lastName, and in the book they are two 
columns, but I want them to be in one column. Actually, what I have are 
one property for "label" and another one for "URL," and I would like 
them to compose an anchor tag.

	Thank you for your precious time!

	Regards,
Mike Jiang




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


Re: How to Customize contrib.TableView for TableColumn and TableView?

Posted by "Tian-Jian \"Barabbas\" Jiang@Gmail" <ba...@gmail.com>.
Peter Svensson wrote:
> ONe thing I use sometimes is to make a new getter/setter which does not
> actually have a property, where I leave the setter empty;
>
> public String getCombined()
> {
>    return getLabel()+getURL();
> }
>
> public void setCombined(String s)
> {
>
> }
>
> Remember that this is probable Not The Way To Do It  :)  But it works for
> me.
>
> The you can take away the value=".... ,label, URL, ..."  and just have
> value="... , combined, ...."  in your table statement.
>
> Cheers,
> PS
Thank you!
Basically I can not just combine them into a getter, because my 
situation was like this:

<component id="table" type="Contrib:TableView">
   <binding name="source" value="list"/>
   <binding name="columns" value="literal:*label:A.label, href:A.url*"/>
</component>
<component id="hrefColumnValue" type="Block"/>
<component id="artistLink" type="GenericLink">
   <binding name="href" value="components.rows.tableRow.*href*"/>
</component>
<component id="label" type="Insert">
   <binding name="value" value="components.rows.tableRow.*label*"/>
</component>

But I've just get an idea and prove it work:
<component id="table" type="Contrib:TableView">
   <binding name="source" value="list"/>
   <binding name="columns" value="literal:*A*"/>
</component>
<component id="hrefColumnValue" type="Block"/>
<component id="artistLink" type="GenericLink">
   <binding name="href" value="components.rows.tableRow.*A.url*"/>
</component>
<component id="label" type="Insert">
   <binding name="value" value="components.rows.tableRow.*A.label*"/>
</component>

That is, I misunderstood the "literal:" prefix of OGNL. I thought it can 
only for String.

Again, thank you for your precious time. :)

    Regards,
Mike

Re: How to Customize contrib.TableView for TableColumn and TableView?

Posted by Peter Svensson <ps...@gmail.com>.
ONe thing I use sometimes is to make a new getter/setter which does not
actually have a property, where I leave the setter empty;

public String getCombined()
{
    return getLabel()+getURL();
}

public void setCombined(String s)
{

}

Remember that this is probable Not The Way To Do It  :)  But it works for
me.

The you can take away the value=".... ,label, URL, ..."  and just have
value="... , combined, ...."  in your table statement.

Cheers,
PS

On 5/19/06, Tian-Jian Tai-ming Jiang@IIS.SINICA <tm...@iis.sinica.edu.tw>
wrote:
>
> Dear all,
>         If I would like to put two properties into one table column, how
> should I customize contrib:Table to do so? It's something like your
> example of Name.firstName/Name.lastName, and in the book they are two
> columns, but I want them to be in one column. Actually, what I have are
> one property for "label" and another one for "URL," and I would like
> them to compose an anchor tag.
>
>         Thank you for your precious time!
>
>         Regards,
> Mike Jiang
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>