Salesforce left the 1000 limit on visualforce components because rerender performance of large dataTables is pretty bad and can make the browser freeze up, something to watch out for.
With the work-around above the limit you need to look out for is heap size as the lists start to become large. If data is too big, I suggest using filtering (on SOQL
) for reducing the data that needs to be returned to the Browser. (Select2
will do the trick)
There is couple of ways to do a work-around.
Here is couple of them...
-Using rows and first params to set the offset and limit on the showing data:
<apex:repeat value="{!myCollection}" var="item" rows="1000" first="0">
{!item.text}
</apex:repeat>
<apex:repeat value="{!myCollection}" var="item" rows="1000" first="1000">
{!item.text}
</apex:repeat>
<apex:repeat value="{!myCollection}" var="item" rows="1000" first="2000">
{!item.text}
</apex:repeat>
-Using wrapper:
Visualforce page:
<apex:page controller="thousandLimit">
<apex:pageBlock >
<apex:repeat value="{!thousandBlocks}" var="block">
<apex:pageBlockTable value="{!block.Accounts}" var="a">
<apex:column value="{!a.Name}"/>
</apex:pageBlockTable>
</apex:repeat>
</apex:pageBlock>
</apex:page>
Controller:
public class thousandLimit
{
private limitWrapper[] thousandBlocks = new limitWrapper[]{};
private final integer listLimit;
public thousandLimit()
{
listLimit = 999;
}
public limitWrapper[] getthousandBlocks()
{
thousandBlocks = new limitWrapper[]{};
integer counter = 0;
integer loopCount = 0;
Account[] tmpAccount = new Account[]{};
for(Account a:[SELECT Id, Name FROM Account])
{
if(counter < listLimit)
{
tmpAccount.add(a);
counter++;
}
else
{
loopCount++;
thousandBlocks.add(new limitWrapper(tmpAccount,loopCount));
tmpAccount = new Account[]{};
tmpAccount.add(a);
counter = 0;
}
}
if(thousandBlocks.size() == 0)
{
loopCount++;
thousandBlocks.add(new limitWrapper(tmpAccount,loopCount));
}
return thousandBlocks;
}
public class limitWrapper
{
public Account[] accounts {get;set;}
public integer blockNumber {get;set;}
public limitWrapper(Account[] accs, integer i)
{
accounts = accs;
blockNumber = i;
}
}
}
-You can user readonly
tag to increase from 1k to 10k:
<apex:page controller="thousandLimit" readonly="true">
<apex:pageBlock >
<apex:repeat value="{!thousandBlocks}" var="block">
<apex:pageBlockTable value="{!block.cases}" var="c">
<apex:column value="{!c.CaseNumber}"/>
<apex:column value="{!c.owner.name}"/>
<apex:column value="{!c.App_Process__c}"/>
<apex:column value="{!c.Load__c}"/>
<apex:column value="{!c.subject}"/>
<apex:column value="{!c.Estimated_Completion_Date__c}"/>
<apex:column value="{!c.Complete__c}"/>
<apex:column value="{!c.Priority}"/>
<apex:column value="{!c.Case_Age_Days__c}"/>
</apex:pageBlockTable>
</apex:repeat>
</apex:pageBlock>
</apex:page>