How to use <apex:repeat> in Visualforce Page?
<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.
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 cannot be used as a direct child of the following components:
< apex:dataTable >
< apex:pageBlockTable >
< apex:panelBar >
< apex:selectCheckboxes >
< apex:selectList >
< apex:selectRadio >
< apex:tabPanel >
This tag supports following attributes:
Attribute
|
Description
|
first
|
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".
|
id
|
An identifier that allows the
repeat component to be referenced by other components in the page.
|
rendered
|
A Boolean value that specifies
whether the component is rendered on the page. If not specified, this value
defaults to true.
|
rows
|
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.
|
value
|
The collection of data that is
iterated over.
|
var
|
The name of the variable that
represents the current item in the iteration.
|
Visualforce Example:
<apex:page controller="repeatCon" id="thePage">
<apex:repeat value="{!strings}" var="string" id="theRepeat">
<apex:outputText value="{!string}" id="theValue"/>
<br/>
</apex:repeat>
</apex:page>
Controller class:
public class repeatCon {
public String[] getStrings() {
return new String[]{'ONE','TWO','THREE'};
}
}
2 comments:
can you give me an example with standard controller ?
Excellent…Amazing…. I’m satisfied to find so many helpful information here within the put up,for latest php jobs in near me. we want work out extra strategies in this regard, thanks for sharing.
Post a Comment