发布日期:2017-07-26 11:00:16

官方文档:http://docs.oracle.com/cd/E23943_01/apirefs.1111/e12419/tagdoc/af_column.html

文章摘录以便快速阅读。

<af:column>

UIComponent class: oracle.adf.view.rich.component.rich.data.RichColumn

Component type: oracle.adf.RichColumn

The immediate children of a Table component must all be <af:column> components. Each visible Column component creates a separate column in the Table.

Use "headerText" attribute or the "header" facet on a Column to create the column header. The following example creates a two-column table with the column headers - "Firstname" and "Lastname":

  <af:table>
    <af:column>
      <f:facet name="header">
        <af:outputText value="Firstname"/>
      </f:facet>
      ...
    </af:column>
    <af:column>
      <f:facet name="header">
        <af:outputText value="Lastname"/>
      </f:facet>
      ...
    </af:column>
  </af:table>
          

The child components of each Column display the data for each row in that column. The Column does not create child components per row; instead, each child is repeatedly rendered (stamped) once per row. Because of this stamping behavior, only certain types of components are supported as children inside a Column. Supported components include all components with no behavior and most components that implement the EditableValueHolder or ActionSource interfaces.

As each row is stamped, the data for the current row ( see getRowData() on the Table) is copied into an EL reachable property. The name of this property is defined by the var property on the Table. Once the Table has completed rendering, this property is removed (or reverted back to its previous value). In the following example, the data for each row is placed under the EL property "row". Each Column displays the data for each row by getting further properties from the "row" property:

  <af:table var="row" value="#{myBean.employees}">
    <af:column>
      <af:outputText value="#{row.firstname}"/>
    </af:column>
    <af:column>
      <af:outputText value="#{row.lastname}"/>
    </af:column>
  </af:table>
          

Sorting

In order to make this Column sortable, set the "sortable" property to true and set "sortProperty" to the name of the model that this column will sort. Sorting can be programatically turned on with the setSortCritiera() method on the\ table.

Column Groups

<af:column> tags can be nested to produce groups of columns. The header of a column group spans across all the columns it contains. The following example creates a column group that has the header "Name" and contains two sub columns with headers "First" and "Last":

Styling

The data cells in the table rendered by<af:column> tags can be styled by using styleClass and inlineStyle attributes. The column header cells can be styled using headerClass attribute. Please note that changing padding and border settings through these attributes is very dangerous. We calculate widths on the server side and expect padding and border attributes to be specified as skinning properties. If they get overridden, the aligment of the table cells might be messed up.

shortDesc attribute is currently not supported for the <af:column>component. Tooltips are automatically displayed for header and data cells if noWrap is turned off and data in the cell is truncated.

  <af:table var="row" value="#{myBean.employees}">
    <af:column headerText="Name">
      <af:column headerText="First">
        <af:outputText value="#{row.firstname}"/>
      </af:column>
      <af:column headerText="Last">
        <af:outputText value="#{row.lastname}"/>
      </af:column>
    </af:column>
  </af:table>

Events

Type Phases Description
org.apache.myfaces.trinidad.event.AttributeChangeEvent Invoke Application,
Apply Request Values
Event delivered to describe an attribute change. Attribute change events are not delivered for any programmatic change to a property. They are only delivered when a renderer changes a property without the application's specific request. An example of an attribute change events might include the width of a column that supported client-side resizing.

Supported Facets

Name Description
context Location for contextual information. A contextInfo component is expected. This facet is stamped in each cell of the column.
filter the node to use to render this column's filter. In most cases application developers will be able to use the filterable="true" and "sortProperty" attributes along with "filterModel" to automatically get the filter support through "inputText" components. However if an application developer wants to support a component other than "inputText", they can use the "filter" facet in addition to setting filterable="true" attribute. When doing this, the application developer should also set the alternate filter's label attribute with a helpful label for accessibility mode compatability. For example, for a filter facet set to an inputDate component representing an employee's join date, you could set the inputDate label="Filter: Join Date". Requirements for filtering based on dates can be met through this facet. A property "filterCriteria" will be available on the table "varStatus" attribute when the filter facet is processed. This property will return a map of filter-property/filterCriteria (name/value pairs). Components inside the filter facet can be bound to this attribute to access the filter criteria.
footer the node to render as this column's footer.
header the node to use to render this column's header.

Attributes

Name Type Supports EL? Description
align String Yes Valid Values: start, end, center, left, right

The alignment for this column. "start", "end" and "center" are used for left-justified, right-justified, and center-justified respectively in LTR display. "left" or "right" can be used when left-justified or right-justified cells are needed irrespective of the LTR or RTL display. The default value is null, which implies that it is skin dependent and may vary for the row header column vs data column.
attributeChangeListener javax.el.MethodExpression Only EL a method reference to an attribute change listener. Attribute change events are not delivered for any programmatic change to a property. They are only delivered when a renderer changes a property without the application's specific request. An example of an attribute change events might include the width of a column that supported client-side resizing.
binding oracle.adf.view.rich.component.rich.data.RichColumn Only EL an EL reference that will store the component instance on a bean. This can be used to give programmatic access to a component from a backing bean, or to move creation of the component to a backing bean.
clientComponent boolean Yes whether a client-side component will be generated. A component may be generated whether or not this flag is set, but if client Javascript requires the component object, this must be set to true to guarantee the component's presence. Client component objects that are generated today by default may not be present in the future; setting this flag is the only way to guarantee a component's presence, and clients cannot rely on implicit behavior. However, there is a performance cost to setting this flag, so clients should avoid turning on client components unless absolutely necessary.
customizationId String Yes This attribute is deprecated. The 'id' attribute should be used when applying persistent customizations. This attribute will be removed in the next release.
displayIndex int Yes The display order index of the column. Columns can be re-arranged and they are displayed in the table based on the displayIndex. Columns are sorted based on the displayIndex property, columns without displayIndex are displayed at the end, in the order in which they appear. The displayIndex attribute is honored only for top level columns, since it is not possible to rearrange a child column outside of the parent column.
Not supported on the following renderkits: org.apache.myfaces.trinidad.core
dontPersist String[] Yes a list of attributes whose changes are NOT to be persisted by FilteredPersistenceChangeManager via the "Persistent Change Manager" registered in adf-config.xml. The token 'ALL' can be used in the list here to indicate that all attribute changes that the component implicitly persists should be excluded. If there is a conflict of values, "dontPersist" always precedes "persist".
filterFeatures java.util.Set Yes The filter features for this column. A set of flags which specify how this column should be filtered in query-by-example (QBE). Currently the only values supported are: "caseSensitive" and "caseInsensitive". If not specified, the case sensitivity is model-dependent. The features are hints for a collection model, which supports filtering, to perform special filtering operations (such as case-sensitive/insensitive filtering)
filterable boolean Yes whether or not the column is filterable. A filterable column will have a filter field on the top of the column header. Note that in order for a column to be filterable, this attribute must be set to "true" and the filterModel attribute will be set on the table. Only Leaf columns are filterable and the filter component is displayed only if the column header is present. The column header is present if the "headerText" attribute or "header" facet is set on the column.

This column's "sortProperty" attribute will be used as a key for the filterProperty in the filterModel. This implies that "sortProperty" *must* be set on the column for it to be filterable.

Also look at "filter" facet for providing a component other than the default inputText for filtering.

footerClass String Yes a CSS style class to use for the column footer. The headerClass, footerClass and the styleClass attributes on the column should be used with caution. Changing the horizontal padding/borders of the header, footer and data cells will mess up alignment of the table cells.
frozen boolean Yes Specifies whether the column is frozen. In the table columns until the frozen column are locked with the header and not scrolled with the rest of the columns. Frozen attribute is honored only on the top level column,since it is not possible to freeze a child column by itself without its parent being frozen. If the table has a detailStamp for its rows, column freezing is turned off.
Not supported on the following renderkits: org.apache.myfaces.trinidad.core
headerClass String Yes a CSS style class to use for the column header. The headerClass, footerClass and the styleClass attributes on the column should be used with caution. Changing the horizontal padding/borders of the header, footer and data cells will mess up alignment of the table cells.
headerNoWrap boolean Yes whether or not the column header should be allowed to wrap
Not supported on the following renderkits: oracle.adf.rich
headerText String Yes text to display in the header of the column. This is a convenience that generates output equivalent to adding a "header" facet containing an outputText. If a "header" facet is added, headerText will not be rendered in column header.
helpTopicId String Yes Id used to look up a topic in a helpProvider.
id String No the identifier for the component. The identifier must follow a subset of the syntax allowed in HTML:
  • Must not be a zero-length String.
  • First character must be an ASCII letter (A-Za-z) or an underscore ('_').
  • Subsequent characters must be an ASCII letter or digit (A-Za-z0-9), an underscore ('_'), or a dash ('-').
inlineStyle String Yes the CSS styles to use for this component. This is intended for basic style changes. The inlineStyle is a set of CSS styles that are applied to the root DOM element of the component. If the inlineStyle's CSS properties do not affect the DOM element you want affected, then you will have to create a skin and use the skinning keys which are meant to target particular DOM elements, like ::label or ::icon-style.
minimumWidth String Yes The minimum number of pixels that the column can become. When a user attempts to resize the column, this minimum width will be enforced. Also, when a column is flexible, it will also never be stretched to be a size smaller than this minimum width. If a pixel width is defined and if the minimum width is larger, the minimum width will become the smaller of the two values. By default, the minimum width is 12 pixels.
Not supported on the following renderkits: org.apache.myfaces.trinidad.core
noWrap boolean Yes Specifies whether whitespace wrapping should be allowed in this column.
partialTriggers String[] Yes the IDs of the components that should trigger a partial update. This component will listen on the trigger components. If one of the trigger components receives an event that will cause it to update in some way, this component will request to be updated too. Identifiers are relative to the source component (this component), and must account for NamingContainers. If your component is already inside of a naming container, you can use a single colon to start the search from the root of the page, or multiple colons to move up through the NamingContainers - "::" will pop out of the component's naming container (or itself if the component is a naming container) and begin the search from there, ":::" will pop out of two naming containers (including itself if the component is a naming container) and begin the search from there, etc.
persist String[] Yes a list of attributes whose changes are to be persisted by FilteredPersistenceChangeManager via the "Persistent Change Manager" registered in adf-config.xml. The token 'ALL' can be used in the list here to indicate that all attribute changes that the component implicitly persists should be included.
rendered boolean Yes whether the component is rendered. When set to false, no output will be delivered for this component (the component will not in any way be rendered, and cannot be made visible on the client). If you want to change a component's rendered attribute from false to true using PPR, set the partialTrigger attribute of its parent component so the parent refreshes and in turn will render this component.
rowHeader String Yes Valid Values: true, false, unstyled

Whether or not this column is the row header column for the table. Valid values are "true", "false", and "unstyled". The default value is "false" and results in no special handling. A column that is marked as rowHeader "true" is moved to the starting position (displayIndex = 0) and is automatically frozen. The value of "unstyled" only has an effect in screenReader mode.

In screen reader mode, when the rowHeader is set to "true" the column's data is also marked with the HTML TH tag. This is important, as screen reader applications expect to see one (and only one) data cell per row marked as the row header for that row. It may be desirable to have a column marked as the rowHeader in screen reader mode but to not be rendered differently in regular mode. For this case you can use the rowHeader "unstyled" value. In regular mode, a column marked as rowHeader "unstyled" does not appear any differently than a column that is rowHeader "false". In screen reader mode, however, a column marked as rowHeader "unstyled" receives the HTML TH tag and is moved to the starting position. Please note that for screen reader mode compatability, a table (or treeTable) should have one (and only one) column marked as either headerText "true" or headerText "unstyled".

selected boolean Yes Specifies whether the column is selected.
Not supported on the following renderkits: org.apache.myfaces.trinidad.core
separateRows boolean Yes This property is currently not supported in the rich client.
Not supported on the following renderkits: oracle.adf.rich
shortDesc String Yes the short description of the component. This text is commonly used by user agents to display tooltip help text, in which case the behavior for the tooltip is controlled by the user agent, e.g. Firefox 2 truncates long tooltips. For form components, the shortDesc is displayed in a note window.
showRequired boolean Yes Indicates whether the columns displays a visual indication of required user input.
sortProperty String Yes The property that is displayed by this Column. This is the property that the framework might use to (for example) sort the Table's data.
sortable boolean Yes whether or not the column is sortable. A sortable column has a clickable header that (when clicked) sorts the table by that column's property. Note that in order for a column to be sortable, this attribute must be set to "true" and the underlying model must support sorting by this column's property.

This column's "sortProperty" attribute must be set if sorting is desired.

styleClass String Yes a CSS style class to use for this component. The style class can be defined in your jspx page or in a skinning CSS file, for example, or you can use one of our public style classes, like 'AFInstructionText'.
visible boolean Yes the visibility of the column. If it is "false", the column will not be displayed in the table on the client. Unlike "rendered", this does affect the lifecycle on the server - the column may have its bindings executed, etc. When "rendered" is false, the component will not in any way be rendered, and cannot be made visible on the client.
Not supported on the following renderkits: org.apache.myfaces.trinidad.core
width String Yes 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.

发表评论