File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes setting Column width for primefaces datatable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "setting Column width for primefaces datatable" Watch "setting Column width for primefaces datatable" New topic
Author

setting Column width for primefaces datatable

Varshini Priya
Ranch Hand

Joined: Feb 17, 2008
Posts: 93

Hi All,


Need some help in setting the column width for the datatable. However, the datatable width does not seem to be uniform.The width of the column in the datatable, seems to vary depending on the column header length. please refer the code below.



In the above case, the column header value length 'View Sales History/Forecast' seems to be large and hence the column width also seems to expand depending on the column header text value. Can you please let me know if there is any way to actually maintain uniformity in the column width and that not depend on the column header text value.

In case if the column header text length is too large, is there a way to maintain uniformity in the column width ?? please Assist. Thanks in Advance
J Miller
Ranch Hand

Joined: Oct 21, 2010
Posts: 67
if you put the outputText inside a <div> tag, and then put a style="width: 15px;" on it, it would force the contents of the DIV to conform to that width. However, instead of just clipping off the end of the text, it would wrap it. So you mgiht get a column where hte header looks like:

Vie
w S
ales
His
tory
/For
cast

or something similar. Or you could come up with a smaller column header name, and put a tooltip on it to give the full text. That's what we're doing in some of our tables.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: setting Column width for primefaces datatable