UIXIterator is a component that performs iteration over its child components. It is similar to UIXTable but has no chrome. Each child is repeatedly stamped as many times as necessary. Iteration is done starting at the index given by the "first" attribute, for as many indices as specified by the "rows" attribute. If "rows" returns 0, then the iteration continues until there are no more elements in the underlying data.
While the <tr:forEach> will be sufficient for most user's needs, it does not work with a JSF DataModel, or CollectionModel. It also cannot be bound to EL expressions that use component-managed EL variables (such as the "var" variable on an <tr:table>), because a forEach tag runs during The <tr:iterator> tag was created to address these issues.
To list all, the benefits of UIXIterator over forEach:
- Access to component-managed EL variables
- Full support for CollectionModel and DataModel
- Does not require creating multiple copies of children, so more memory efficient
- Much better at dealing with adding and deleting children, at least when used with a CollectionModel with a good implementation of getRowKey()
- Supports "binding", and all other forms of JSF component manipulation
and the negative aspects:
- Leaves behind a component in the hierarchy, which causes problems with components like panelFormLayout that try to handle each child individually.
- Because there's only one of each child, the same limitations on "binding", etc., as apply inside a table also apply to iterator.
Events:
Type | Phases | Description |
org.apache.myfaces.trinidad.event.AttributeChangeEvent | 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. |