Newer Version Available

This content describes an older version of this product. View Latest

apex:repeat

An iteration component that allows you to output the contents of a collection according to a structure that you specify. The collection can include up to 1,000 items.

Use this component to get user input for a controller method that does not correspond to a field on an sObject. Only <apex:inputfield> and apex:outfield can be used with sObject fields.

Note that if used within an <apex:pageBlockSection> or <apex:panelGrid> component, all content generated by a child <apex:repeat> component is placed in a single <apex:pageBlockSection> or <apex:panelGrid> cell.

This component can't be used as a direct child of the following components:
  • <apex:panelBar>
  • <apex:selectCheckboxes>
  • <apex:selectList>
  • <apex:selectRadio>
  • <apex:tabPanel>

Example

The example above renders the following HTML:

Standard Component Example

Attributes

Attribute Name Attribute Type Description Required? API Version Access
first Integer The first element in the collection visibly rendered, where 0 is the index of the first element in the set of data specified by the value attribute. For example, if you did not want to display the first two elements in the set of records specified by the value attribute, set first="2". 10.0 global
id String An identifier that allows the repeat component to be referenced by other components in the page. 10.0 global
rendered Boolean A Boolean value that specifies whether the component is rendered on the page. If not specified, this value defaults to true. 10.0 global
rows Integer The maximum number of items in the collection that are rendered. If this value is less than the number of items in the collection, the items at the end of the collection are not repeated. 10.0 global
value Object The collection of data that is iterated over. 10.0 global
var String The name of the variable that represents the current item in the iteration. 10.0 global