• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

columnClasses in HtmlDataTable

 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there a way to tell a dataTable that the styles you declare are to belong to the columns you declare in in jsf tags in the order they appear, and not simply to the columns that are rendered?

In this example if #{rules.col2Rendered} returns false and the others return true, then the styles col1, col2 will be assigned to the columns with id "col1" and "col3" since theyre the only ones rendered, instead I want these to have the styleClasses col1 and col3. How do I achieve this?

[ September 12, 2005: Message edited by: seb petterson ]
[ September 12, 2005: Message edited by: seb petterson ]
 
seb petterson
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess there is not. Instead I will get a string for columnClasses from bean method that calculates which styleclasses should be used. I don't like to have stuff that I feel belongs in web content files (jsps etc.) in java code, but oh well.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For what it's worth, you'll want to use the <h:dataTable> tag instead; that caters for repeating rows.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by seb petterson:
I guess there is not. Instead I will get a string for columnClasses from bean method that calculates which styleclasses should be used. I don't like to have stuff that I feel belongs in web content files (jsps etc.) in java code, but oh well.



Yes, the work around you suggested is the best way to do it. I have done in lot of pages (even it costs specifing the styleclass name in the java file)
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
why dont you use the condition and respective column classes within columnClasses attribute.

i mean [B][/B]

Hope this works.
 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One possible workaround is to filter the list prior to rendering, i.e. have a copy of the list and the set the filtered list to the data table so that you can still use the columnClasses attribute in the data table.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had the same problem and I just tried Puneet Swarup's solution -which I believe to be the most elegant of the ones proposed thus far here. It worked perfectly. I had struggled to try to do the same with the A?B:C conditional notation but had failed time and time again. I would have continued to bang my head against the wall for hours had it not been for this thread. I never would have imagined that I had to enclose the columnClasses values in simple apostrophes ('). It's still a little confusing to me when to and not to use apostrophes. So, thanks a million, Swarup.
reply
    Bookmark Topic Watch Topic
  • New Topic