• 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
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Jj Roberts
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Himai Minh
  • Carey Brown
  • salvin francis

[DisplayTag] How to make Multi-column header

 
Ranch Hand
Posts: 2108
  • 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: 2108
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic