ip.wfm wrote:
> hi everyone,
>
> My team has an interesting design problem for the displaytag community.
>
> What we are trying to accomplish is to render a table with 31 columns, where
> columns 1 through 17 render on a first 'row' and columns 18 through 31
> render on a second 'row', nested in a hidden div. 
>   

I'm sure you're aware that placing a <div> inside a <table> is not 
adhering to the html spec. It's a good indication that you're trying to 
do something odd that's unlikely to be supported by DisplayTag.

> So, when the user hits our page, they see several first 'rows' rendered. We
> then have a button-like trigger for each row that calls some js to unhide
> the second 'row' div.
>
> Through experimentation, it seems that displaytag does not allow html to be
> embedded between display:columns. 
>   

That's because it's been designed to produce conforming html.

> Next, we tried using a TableDecorator to access the actual <tr> and <td>
> tags of the output table. I thought a good approach here might be to get at
> the actual pre-rendered HTML at the 17th <td>, put in a <br> and <div>
> manually. However, looking at TableDecorator->tableModel only seems to yield
> object notation and not editable HTML.
>   

The TableDecorator allows you to decorate the data inside the <td> or 
<th> tags or allows you to add data before or after the current row. 
That last bit is probably what you're after. I think you'll need to only 
add the first 17 columns as <display:column>s in your <display:table> 
tag. Your TableDecorator can then implement the finishRow() method and 
do something like this:

public String finishRow() {
    MyRow myRow = (MyRow)this.getCurrentRowObject();
    StringBuffer sb = new StringBuffer();
    sb.append("<div class=\"hiding\"><tr>");
    for (int i = 18; i < 32; i++) {
       sb.append("<td>");
       sb.append(myRow.getColumn(i));
       sb.append("</td>");
    }
    sb.append("</tr></div>");
    return sb.toString();
}
> What am I missing here? Is there an elegant way for displaytag to wrap a
> long row, putting half of it in a hidden div?
>   
There isn't an elegant way to do it because it's not an elegant thing to 
do. However the above should get you what you want.

Ed!

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
displaytag-user mailing list
displaytag-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/displaytag-user

Reply via email to