I need to find the way to use something different than apex:repeat. to assign the
value="{!thousandBlocks} var="block" This is creating multiple tables and i don't want that.
Let me explain you, the class is requesting a large amount of data and i created a wrapper class. and for some reason the vf page is displaying many pageBlockTables and I just want to display just one. My guess is that the apex:repeat is causing this. So I was wondering if there is another apex control that I can use instead of 'repeat' to get the value="{!thousandBlocks} var="block"
I will appreciate any help
VF Page code:
<apex:pageBlock >
<apex:repeat value="{!thousandBlocks} var="block" >
<apex:pageBlockTable value="{!block.zeroInventory}" var="p" id="mid">
<apex:column value="{!p.Account__r.Name}"/>
<apex:column value="{!p.Name}"/>
<apex:column value="{!p.Product_Name__c}"/>
</apex:pageBlockTable>
</apex:repeat>
</apex:pageBlock>
class:
public class dashBoardPOIssues {
private limitWrapper[] thousandBlocks = new limitWrapper[]{};
private final integer listLimit;
public dashBoardPOIssues(){
//for zero inventory
listLimit = 950;
}
//for zero inventory
public limitWrapper[] getthousandBlocks()
{
thousandBlocks = new limitWrapper[]{};
integer counter = 0;
integer loopCount = 0;
NRProducts__c[] tmpcase = new NRProducts__c[]{};
for(NRProducts__c c:[SELECT id, Name, Account__r.Name, ASIN__c,CreatedDate,Product_Name__c,Virtual_Amz__c,Total_Inventory2__c,Days_of_Inventory__c,X24_Hr_Units__c,X7_Day_Units__c,X30_Day_Units__c FROM NRProducts__c WHERE Total_Inventory2__c = 0 AND Buyer_lookup__c =:UserInfo.getUserId()])
{
if(counter < listLimit)
{
tmpcase.add(c);
counter++;
}
else
{
loopCount++;
thousandBlocks.add(new limitWrapper(tmpcase,loopCount));
tmpcase = new NRProducts__c[]{};
tmpcase.add(c);
counter = 0;
}
}
if(thousandBlocks.size() == 0)
{
loopCount++;
thousandBlocks.add(new limitWrapper(tmpcase,loopCount));
}
return thousandBlocks;
}
public class limitWrapper
{
public NRProducts__c [] zeroinventory {get;set;}
public integer blockNumber {get;set;}
public limitWrapper(NRProducts__c[] accs, integer i)
{
zeroinventory = accs;
blockNumber = i;
}
}
}
Best Answer
I've answered a similar question some time ago: Add more than 1000 picklist values in visualforce page (controller 1000 list items limit)
You should ask yourself how usable it'll be to display over 1000 records? This suggests it's going to be a dashboard component - that'd be pretty long one...
Your "proper" options:
<apex:page readonly="true">
and the limit will go to 10K.Buyer_lookup__c
). Once you have that you can simply throw the<apex:enhancedList>
at the page, no apex code required, no unit tests to write...Your "subprime" ;) option (because even if you'll manage to get it to work you'll hit limits like viewstate or the one you've quoted: "Response size exceeded 15MB") would be to create a
List<List<NRProducts__c>>
and have 2 nested<apex:repeat>
s.It could look similar to that (I have 36 Opportunities in my Developer Edition):