• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

[DisplayTag] How to make Multi-column header

 
Ranch Hand
Posts: 2108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Willie Smits can speak 40 languages. This tiny ad can speak only one:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic