hi Ed, Thanks for your suggestion, though we took a slightly different route.
To accomplish a split-row table using displaytag (columns 1 to 17 on first 'row', 18 to 31 on second 'row') we had displaytag explicitly render the first 'row' and use a table decorator as you suggested. However, we did not include HTML in our TableDecorator-extending class as that would muck up the MVC convention of keeping HTML/javascript out of Java classes. Instead, we had a finishRow() inside our TableDecorator-extending class load a .jsp file that includes an AJAX-div. This AJAX-div then dynamically loads our second 'row' (columns 18 to 31) . The DIV-load is triggered, and its contents rendered by clicking on a graphic at the beginning of the first 'row'. Of course, we can't use displaytag to sort by anything in the second 'row', but then that was not one of our requirements. So, by all appearances, problem solved. Thanks again for your input. ip.wfm p.s. Of course you can do something inelegant elegantly! Haven't you heard of Monty Python? :-) Ed Webb wrote: > > 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 > > -- View this message in context: http://www.nabble.com/Displaytag-table-wrapping-%2B-hidden-div-tp18324348p18965459.html Sent from the DisplayTag - General mailing list archive at Nabble.com. ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ displaytag-user mailing list displaytag-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/displaytag-user