Product Logos BridgeIt Services Banner
ice:dataTable header and column width  XML
Forum Index -> Components
Author Message
crawling5

Joined: 19/Sep/2007 00:00:00
Messages: 31
Offline


Hi,

I created a dataTable in my page, without specified width.
My problem is the headers haven't the same width of their column (see the attached file).

I don't know the maximum size of the value in the columns, so, it's difficult to set a width.

How can I resolve this ?
[Thumb - dataTableHeader.jpg]
 Filename dataTableHeader.jpg [Disk] Download
 Description
 Filesize 20 Kbytes
 Downloaded:  716 time(s)

michael.thiem


Joined: 04/Jun/2007 00:00:00
Messages: 704
Offline


Hi,

in order to adjust your headers you would need to set the columnWidths
attribute of the dataTable component. You can do this either statically like

Code:
 <ice:dataTable columnWidths="75px,75px,75px" ... >
 


or dynamically if you have to calculate the appropriate size first:

Code:
 <ice:dataTable columnWidths="#{bean.columnWidths}" ... >
 


In your bean you would then need a method getColumnWidths which
returns the correct column sizes:

Code:
 public String getColumnWidths() {
    //calculate and the appropriate widths as list like
    return "75px,75px,75px";
 }
 


Hope that helps.

Michael
charliepjive


Joined: 31/Jul/2007 00:00:00
Messages: 52
Offline


Hi Michael,

Any ideas on how to calculate the column size according to cell content?

Thanx in advance

Sasà
knehez

Joined: 03/Mar/2008 00:00:00
Messages: 5
Offline


Hi charliepjive,

I have the same problem, did you find a good dynamic solution?

Thanks in advance
charliepjive


Joined: 31/Jul/2007 00:00:00
Messages: 52
Offline


Sorry,
Still found nothing. I got a lot of work. If i'll got more time I'll dig in this better.

Sasà
dkohl

Joined: 02/Jun/2007 00:00:00
Messages: 13
Offline


Unfortunately columns and headers doesn't match on scrollable datatables, even if i set the columns manually (using xp.css or rime.css).

Code:
 columnWidths="400px,200px,100px,100px"
 


Using IceFaces 1.7.0, Linux, Firefox 2.0
charliepjive


Joined: 31/Jul/2007 00:00:00
Messages: 52
Offline


thanx for the feedback

greetings,

Sasà
dkohl

Joined: 02/Jun/2007 00:00:00
Messages: 13
Offline


i solved this by setting the size in px for each component:

Code:
 <ice:column  style="width:410px;">
 	<f:facet name="header">
            <ice:outputText value="Name" style="width:410px;"/>
          </f:facet>
          <ice:commandLink value="....." />
 </ice:column>							
 


works fine for scrollable und unscrollable tables, but it's still a workaround. i would really prefer the columnWidths-attribute-solution.

Greetings
rliao3089

Joined: 21/May/2008 00:00:00
Messages: 2
Offline


Make sure you don't "sqeeze" the table. I have the similar problem and the reason is I have a container "style" and the width is too small. Once I increased the container width, the colums aligned!
 
Forum Index -> Components
Go to:   
Powered by JForum 2.1.7ice © JForum Team