You need to sign in to do that
Don't have an account?
how can I know is there a next item exists or not in apex:repeat
Hi All,
I am repeating list and displaying the list items.
On each iteration am appending the comma ( , ) for separation.
But there is an extra "," at the end of the text.
code used:-
<apex:repeat value="{!ulist.userGroups}" var="userGroups">
<apex:commandLink action="{!groupDetails}" style="text-decoration: none;color: #0066CC;">
<apex:outputText value="{!userGroups.groupName}"/>
<apex:outputText rendered="{!(ulist.userGroups.size > 1)}"> , </apex:outputText>
</apex:commandLink>
</apex:repeat>
how can I know is there a next item exists or not in apex:repeat ?
Thanks
Got the solution :)
<apex:variable value="{!0}" var="num" />
<apex:repeat value="{!ulist.userGroups}" var="userGroups">
<apex:variable var="num" value="{!num + 1}"/>
<apex:commandLink action="{!groupDetails}" style="text-decoration: none;color: #0066CC;">
<apex:outputText value="{!userGroups.groupName}"/>
<apex:outputText rendered="{!(num < ulist.userGroups.size)}">, </apex:outputText>
</apex:commandLink>
</apex:repeat>