Thursday, December 23, 2010

Making the columns of an ADF table resizable

The columns of an ADF table can be made re sizable using column level attributes width and minimumWidth. Either absolute numbers or percentages can be used to make them re sizable.

width :The width of the column. The default width for a column is 100px. There is no auto sizing for columns. Set the width attribute to ensure the column is wide enough to accommodate the width of the contents.

minimumWidth : The minimum number of pixels that the column can become. When a user attempts to resize a column, this minimumWidth will be enforced. Also, when a column is flexible, it will never be stretched to be a size smaller than this minimumWidth. If a pixel width is defined and if the minimumWidth is larger, the minimumWidth will become the smaller of the two values. By default the minimum width is 12 pixels. This attribute is not supported on the following agent types :- phone and voice.


Example :-

<af:column align="right"
 headerText=
 "#{bindings.ForecastItemDetail.hints.WinProb.label}(%)"
 id="c26" sortProperty="WinProb"
 sortable="true">
  <af:outputText id="ot47"
  value="#{row.WinProb}">
  <af:convertNumber pattern="#{applCorePrefs.numberFormatPattern}"
    type="number"/>
  </af:outputText>
  <f:facet name="footer">
   <af:outputText value="outputText7"
    id="ot24" visible="false"/>
  </f:facet>
 </af:column>


Tip:- In case of an ADF applications table, if a detailStamp or a ShowDetail column is part of the table, then the column resize does not work as expected.

1 comment:

Anonymous said...

what you say is very wrong, you can automatically resize a table and its columns by setting the property "columStreching" to "multiple" and by putting width="x%" for the columns (the sum must be 100
5)