This week's book giveaway is in the General Computing forum.
We're giving away four copies of Emmy in the Key of Code and have Aimee Lucido on-line!
See this thread for details.
Win a copy of Emmy in the Key of Code this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

[DisplayTag] How to make Multi-column header

 
Ranch Hand
Posts: 2103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

It is common to have one 'title' for each column. Below is a visualization.



Is it possible to have only 1 'title' for the 3 column, like below?





 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jesus Angeles,

You can create a single header for three columns using colspan tag.
 
Jesus Angeles
Ranch Hand
Posts: 2103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How is it done for DisplayTag?

I have something like below.

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know this answer is too late for you, but maybe someone in the web will find it as useful.
in order to add colspan attribute for TH in displaytag (or other HTML attribute) you should do the follwing:
1. create a table decorator (extend TableDecorator)
2. override the method init(PageContext pageContext, Object decorated, TableModel tableModel)
3. in the init method add html attribute like this:
HeaderCell oneHeader;
List headersList = tableModel.getHeaderCellList();
for (int i =0; i< headersList.size(); i++)
{
oneHeader = (HeaderCell) headersList.get(i);
HtmlAttributeMap oneHtmlAttributeMap = oneHeader.getHeaderAttributes();
oneHtmlAttributeMap.put("colSpan", "3");
oneHeader.setHtmlAttributes(oneHtmlAttributeMap);
}

now, each th in your table has html attribute colSpan=2.

enjoy.
 
if you think brussel sprouts are yummy, you should try any other food. And this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!