You need to sign in to do that
Don't have an account?
Newbie999
Can someone explain the working of <li> and <apex:repeat> w.r.t. the below code?
<apex:page standardController="Account" recordSetVar="accounts">
<apex:pageBlock title="Accounts">
<apex:repeat value="{!Accounts}" var="a">
<li>
<apex:outputLink value="/{!a.id}">{!a.Name}</apex:outputLink>
</li>
</apex:repeat>
</apex:pageBlock>
</apex:page>
BELOW IS THE OUTPUT OF THE ABOVE PROGRAM
<apex:pageBlock title="Accounts">
<apex:repeat value="{!Accounts}" var="a">
<li>
<apex:outputLink value="/{!a.id}">{!a.Name}</apex:outputLink>
</li>
</apex:repeat>
</apex:pageBlock>
</apex:page>
BELOW IS THE OUTPUT OF THE ABOVE PROGRAM
Hello,
apex:repeat is just like loop operator FOR and the HTML <li> tag represents a list item in ordered and unordered lists.
thus, it is the same like in Apex code
The HTML <li> element is used to represent an item in a list. It must be contained in a parent element: an ordered list (<ol>), an unordered list (<ul>), or a menu (<menu>). In menus and unordered lists, list items are usually displayed using bullet points. In ordered lists, they are usually displayed with an ascending counter on the left, such as a number or letter.
For more details refer the below link:
https://salesforce.stackexchange.com/questions/5829/datalist-li-style
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.
Link for apex:repeat :
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_repeat.htm
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi