• 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
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

[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.
 
The two armies met. But instead of battle, they decided to eat some pie and contemplate 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!