function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
JimmyMacJimmyMac 

How To Break Out Of <apex:repeat>

JimmyMacJimmyMac

Is there anyway while looping through a <apex:repeat to break out of the loop.

 

Thanks.

 

 

Shailesh DeshpandeShailesh Deshpande
You can use "rows" attribute to limit the number of records that are rendered. But this will consider the order in which the records are present in the list.
DaveHDaveH

apex:repeat is a server side operation with limited flexibility. If you need tighter control over exactly when the repeat needs to stop then you will probably need to incorporate javascript and handle building the table (or whatever you need the repeat tag for) within a javascript loop. 

 

For example you could declare an array of objects in javascript which holds data for your table, use the repeat tag to add the data into your javascript array and then loop through the array that way.