Apex Repeat Tag Tip and Instant Feedback

I was working on a custom component for a client the other day where I wanted to use the apex:repeat tag to iterate through a collection (specifically a set) and display the results for breadcrumb-like functionality.  Naturally, my first stop was the online docs as things change so rapidly I wanted to make sure I had the most up-to-date information.

Everything looked good, I set about creating my repeat tag and passed a Set in for the value attribute. My repeat tag looked like the following, with titles being a Set of SObjects:

<apex:repeat value="{!titles}" var="pagename" id="theRepeat" >
  <apex:commandLink action="{!gotopage}" 
value="{!pagename}" styleClass="btn" id="btnNext">
<apex:param assignTo="{!gopagename}" value="{!pagename}" />
   </apex:commandLink> |
</apex:repeat>

Unfortunately, this failed and after after debugging the issue I found the cause was that the value attribute only supports arrays and not collections yet. With a little refactoring I changed my code to use a String array instead and I was soon seeing my results rendering great.

 Like everything else in the force.com platform, things are moving quickly with new features added all the time. The great thing is that not only can you provide instant feedback to the documentation team through the feedback forms at the bottom of every page of the online docs, but you can also add an idea to ideas.salesforce.com for the community to vote on and help the product management team add the features which are most important to you.

 (example of the online documentation feedback form)


Published
November 25, 2008

Leave your comments...

Apex Repeat Tag Tip and Instant Feedback