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

Managing the width of the columns of datatable

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
In my application I am showing a dataTable .The dataTable has 4 columns.
I want that all the columns will take same width(i.e. each column will 25% width of the dataTable) irrespective of the data length.
But I am not able to control that one beacuse <h:column> doesn't have width attribute.
What is happening in my application is that the columns size is diffrent depending upon the length of the data.as example--

-------------------------------------
col1| col2 | col3 |col4
-------------------------------------
1 | jdjhsdhsdshj | 1 |2

as the length of the col2 data is bigger than others so it's taking the most of the width .
But I want that each column should have the same width.

How can i do that one.please help.
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
you can use columnClasses attribute of dataTable tag to specify css classes for columns.
Please take a look at this page

BR
Zbyszko
[ May 19, 2008: Message edited by: Zbyszko Palka ]
 
Saloon Keeper
Posts: 28319
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Almost anything visual for JSF is set by CSS.
 
Dwijen Bhattacharjee
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for yours reply .Actually I am already using ColumnClasses,StyleClass to display the table with some style..

In the columnClasses i used a css style to set the data alignment for diffrent column.now if i add the width with that style then.in all other pages where i am using the same style they also set to the same width. but that pages may have more or less number of columns so the alignment getting wrong.
for clarification i use the following css in columnClasses
.leftAlign{
text-align :"left";
}
.leftRight{
text-align :"right";
}
now if i add width then all other pages are getting effected .
now one solution may be to use diffrent style sheet with diffrent width as appropate.but is it good practice? as there will be repetation of the alignment ;only the width is changing..please suggest.
 
I have gone to look for myself. If I should return before I get back, keep me here with this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic