You need to sign in to do that
Don't have an account?
Rajesh SFDC
how to solve this error:Collection size 1,247 exceeds maximum size of 1,000. in visualforce page?
how to solve this error:Collection size 1,247 exceeds maximum size of 1,000. here my requirments i want to display 3000 reocords in visualforce page but i am getting an error,, plz help me frds
<apex:page controller="wrapperController" sidebar="false" >
<apex:form >
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:commandButton value="Show Selected Accounts" action="{!processSelected}" rerender="table2"/>
</apex:pageBlockButtons>
<apex:pageblockSection title="All Accounts" collapsible="false" columns="2">
<apex:pageBlockTable value="{!wrapAccountList}" var="accWrap" id="table" title="All Accounts">
<apex:column >
<apex:facet name="header">
<!--apex:inputCheckbox onclick="selectAllCheckboxes(this,'inputId')"/-->
</apex:facet>
<apex:inputCheckbox value="{!accWrap.selected}" id="inputId"/>
</apex:column>
<apex:column value="{!accWrap.acc.Name}" />
<apex:column value="{!accWrap.acc.Phone}" />
</apex:pageBlockTable>
<apex:pageBlockTable value="{!selectedAccounts}" var="c" id="table2" title="Selected Accounts">
<apex:column value="{!c.Name}" headerValue="Account Name"/>
<apex:column value="{!c.Phone}" headerValue="Phone"/>
</apex:pageBlockTable>
</apex:pageblockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
====================================================================================================controller =========================
public class wrapperController{
//Our collection of the class/wrapper objects wrapAccount
public List<wrapAccount> wrapAccountList {get; set;}
public List<Account> selectedAccounts{get;set;}
string currentrecordid= ApexPages.currentPage().getParameters().get('id');
public wrapperController()
{
if(wrapAccountList == null)
{
wrapAccountList = new List<wrapAccount>();
LIST<Account> ac=new list<Account>();
map<string,string> resultmap=new map<string,string>();
// integer countrecord=[select count() from account ];
system.debug('^^^^^^^^countrecord+countrecord');
ac=[select Id, Name, Website, Phone from Account ];
for(Account a: ac )
{
wrapAccountList.add(new wrapAccount(a));
system.debug('$$$$$$$$$$$$$$$$4'+wrapaccountlist);
}
}
}
public void processSelected()
{
selectedAccounts = new List<Account>();
for(wrapAccount wrapAccountObj : wrapAccountList)
{
system.debug('@@@@@@@@@@@@@@@222'+wrapAccountObj);
if(wrapAccountObj.selected == true)
{
selectedAccounts.add(wrapAccountObj.acc);
}
}
}
public class wrapAccount
{
public Account acc {get; set;}
public Boolean selected {get; set;}
public wrapAccount(Account a)
{
system.debug('##########'+a);
acc = a;
system.debug('*************acc'+acc);
selected = false;
system.debug('selectd'+selected);
}
}
}
=======================================================================================================================================================
<apex:page controller="wrapperController" sidebar="false" >
<apex:form >
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:commandButton value="Show Selected Accounts" action="{!processSelected}" rerender="table2"/>
</apex:pageBlockButtons>
<apex:pageblockSection title="All Accounts" collapsible="false" columns="2">
<apex:pageBlockTable value="{!wrapAccountList}" var="accWrap" id="table" title="All Accounts">
<apex:column >
<apex:facet name="header">
<!--apex:inputCheckbox onclick="selectAllCheckboxes(this,'inputId')"/-->
</apex:facet>
<apex:inputCheckbox value="{!accWrap.selected}" id="inputId"/>
</apex:column>
<apex:column value="{!accWrap.acc.Name}" />
<apex:column value="{!accWrap.acc.Phone}" />
</apex:pageBlockTable>
<apex:pageBlockTable value="{!selectedAccounts}" var="c" id="table2" title="Selected Accounts">
<apex:column value="{!c.Name}" headerValue="Account Name"/>
<apex:column value="{!c.Phone}" headerValue="Phone"/>
</apex:pageBlockTable>
</apex:pageblockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
====================================================================================================controller =========================
public class wrapperController{
//Our collection of the class/wrapper objects wrapAccount
public List<wrapAccount> wrapAccountList {get; set;}
public List<Account> selectedAccounts{get;set;}
string currentrecordid= ApexPages.currentPage().getParameters().get('id');
public wrapperController()
{
if(wrapAccountList == null)
{
wrapAccountList = new List<wrapAccount>();
LIST<Account> ac=new list<Account>();
map<string,string> resultmap=new map<string,string>();
// integer countrecord=[select count() from account ];
system.debug('^^^^^^^^countrecord+countrecord');
ac=[select Id, Name, Website, Phone from Account ];
for(Account a: ac )
{
wrapAccountList.add(new wrapAccount(a));
system.debug('$$$$$$$$$$$$$$$$4'+wrapaccountlist);
}
}
}
public void processSelected()
{
selectedAccounts = new List<Account>();
for(wrapAccount wrapAccountObj : wrapAccountList)
{
system.debug('@@@@@@@@@@@@@@@222'+wrapAccountObj);
if(wrapAccountObj.selected == true)
{
selectedAccounts.add(wrapAccountObj.acc);
}
}
}
public class wrapAccount
{
public Account acc {get; set;}
public Boolean selected {get; set;}
public wrapAccount(Account a)
{
system.debug('##########'+a);
acc = a;
system.debug('*************acc'+acc);
selected = false;
system.debug('selectd'+selected);
}
}
}
=======================================================================================================================================================
http://kuldeeptyagi.blogspot.in/
Try to use like this if you need to view only records
<apex:page controller="sample" readOnly="true">
</apex:page>
It will bring upto 1 million records but we can't able to do some process of insert,update.
You can try readonly attribute before pagination code..
Thank You
However, larger sizes of list would have a negative effect on the VF page as it will take a lot of time to load the page.
Regards,
Satish Kumar
Use readonly="true" attribute of <apex:page> tag or else use pagination to display records in visualforce page.
Please let me know if u need further help.