apex:dataList

An ordered or unordered list of values that is defined by iterating over a set of data. The body of the <apex:dataList> component specifies how a single item should appear in the list. The data set can include up to 1,000 items.

Example 

1<!-- Page: -->
2<apex:page controller="dataListCon">
3    <apex:dataList value="{!accounts}" var="account">
4        <apex:outputText value="{!account.Name}"/>
5    </apex:dataList>
6</apex:page>
7
8/*** Controller: ***/
9public class dataListCon {
10
11	List<Account> accounts;
12
13	public List<Account> getAccounts() {
14		if(accounts == null) accounts = [SELECT Name FROM Account LIMIT 10];
15		return accounts;
16	}
17
18}

The example above renders the following HTML:

1<ul id="thePage:theList">
2	<li id="thePage:theList:0">Bass Manufacturing</li>
3	<li id="thePage:theList:1">Ball Corp</li>
4	<li id="thePage:theList:2">Wessler Co.</li>
5</ul>

Attributes 

Attribute NameAttribute TypeDescriptionRequired?API VersionAccess
dirStringThe direction in which the generated HTML component should be read. Possible values include “RTL” (right to left) or “LTR” (left to right). 10.0global
firstIntegerThe first element in the iteration that is visibly rendered in the list, 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.0global
idStringAn identifier that allows the dataList component to be referenced by other components in the page. 10.0global
langStringThe base language for the generated HTML output, for example, “en” or “en-US”. For more information on this attribute, see the W3C specifications. 10.0global
onclickStringThe JavaScript invoked if the onclick event occurs–that is, if the user clicks the list. 10.0global
ondblclickStringThe JavaScript invoked if the ondblclick event occurs–that is, if the user clicks the list twice. 10.0global
onkeydownStringThe JavaScript invoked if the onkeydown event occurs–that is, if the user presses a keyboard key. 10.0global
onkeypressStringThe JavaScript invoked if the onkeypress event occurs–that is, if the user presses or holds down a keyboard key. 10.0global
onkeyupStringThe JavaScript invoked if the onkeyup event occurs–that is, if the user releases a keyboard key. 10.0global
onmousedownStringThe JavaScript invoked if the onmousedown event occurs–that is, if the user clicks a mouse button. 10.0global
onmousemoveStringThe JavaScript invoked if the onmousemove event occurs–that is, if the user moves the mouse pointer. 10.0global
onmouseoutStringThe JavaScript invoked if the onmouseout event occurs–that is, if the user moves the mouse pointer away from the list. 10.0global
onmouseoverStringThe JavaScript invoked if the onmouseover event occurs–that is, if the user moves the mouse pointer over the list. 10.0global
onmouseupStringThe JavaScript invoked if the onmouseup event occurs–that is, if the user releases the mouse button. 10.0global
renderedBooleanA Boolean value that specifies whether the component is rendered on the page. If not specified, this value defaults to true. 10.0global
rowsIntegerThe maximum number of items to display in the list. If not specified, this value defaults to 0, which displays all possible list items. 10.0global
styleStringThe style used to display the dataList component, used primarily for adding inline CSS styles. 10.0global
styleClassStringThe style class used to display the dataList component, used primarily to designate which CSS styles are applied when using an external CSS stylesheet. 10.0global
titleStringThe text to display as a tooltip when the user’s mouse pointer hovers over this component. 10.0global
typeStringThe type of list that should display. For ordered lists, possible values include “1”, “a”, “A”, “i”, or “I”. For unordered lists, possible values include “disc”, “square”, and “circle”. If not specified, this value defaults to “disc”. 10.0global
valueObjectThe collection of data displayed in the list.Yes10.0global
varStringThe name of the variable that should represent one element in the collection of data specified by the value attribute. You can use this variable to display the element in the body of the dataList component tag.Yes10.0global