You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Alan Chaney <al...@compulsivecreative.com> on 2006/04/27 16:42:47 UTC

Using ITableColumn with a hyperlink

Hi

My application displays information from a database in tables - whoa! 
nothing new there... However, in one case the whole structure of the 
table is 'dynamic', in that the number of columns, the headers and the 
type of information within the columns is configured by the user. I have 
been studying the contrib Table component and it seems that by using 
ITableColumn I can easily generate an iteratior of an object supporting  
ITableColumn to render both header and row data.

My problem is simple - how do I make one of the rows into a link to 
another page? With the more 'static' versions I have followed the 
approach as laid out in the very excellent EWDT [Tong] (every Tapestry 
developer should have one)

It seems to me that one approach is simply to create a PageLink object 
in my code and render this into the required column.
I'm not sure if this is really in the 'ethos' of Tapestry, so maybe 
there is a better way to do it?

Thanks in advance

Regards

Alan Chaney


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


Re: Using ITableColumn with a hyperlink

Posted by Peter Svensson <ps...@gmail.com>.
 Hmm. Maybe this is no good solution, but I would do a quick and dirty
solution, like this;

<div jwcid="@contrib:Table" source="ognl:items" value="ognl:currentItem">
    <div jwcid="column@Block">
         <div jwcid="@PageLink" page="ognl:properPage">
             <div jwcid="@Insert" value="ognl:currentItem"/>
         </div>
    </div>
</div>


And then have in the class

public abstract void setCurrentItem(Item i);
public abstract Item getCurrentItem();

public Set getItems()
{
....
}

public String getProperPage()
{
... Perhaps check the currentItem and return a proper page name here, like
"Home" or something
}


But if you want to have a table which link to an autmatically generated
editpage for the properties, you might check out the trails project, which
generate a lot of the stuff you need, but if you want to rough it, this
might help.

Cheers,
PS
On 4/27/06, Alan Chaney <al...@compulsivecreative.com> wrote:
>
> Hi
>
> My application displays information from a database in tables - whoa!
> nothing new there... However, in one case the whole structure of the
> table is 'dynamic', in that the number of columns, the headers and the
> type of information within the columns is configured by the user. I have
> been studying the contrib Table component and it seems that by using
> ITableColumn I can easily generate an iteratior of an object supporting
> ITableColumn to render both header and row data.
>
> My problem is simple - how do I make one of the rows into a link to
> another page? With the more 'static' versions I have followed the
> approach as laid out in the very excellent EWDT [Tong] (every Tapestry
> developer should have one)
>
> It seems to me that one approach is simply to create a PageLink object
> in my code and render this into the required column.
> I'm not sure if this is really in the 'ethos' of Tapestry, so maybe
> there is a better way to do it?
>
> Thanks in advance
>
> Regards
>
> Alan Chaney
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>