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
nagalakshminagalakshmi 

How to display the Records more than 1000 in visual force page using select options

Hi, 

 

How to display the records more than 1000 using visual force page select options. I am getting the error as 

 

Collection size 1,829 exceeds maximum size of 1,000. How to solve this error. Please help me.

 

 

Thanks,

Lakshmi. 

kiranmutturukiranmutturu

you can use standarad set controller or u can use nested list to display more than 1000...

ram1234ram1234

i hav displayed all 1000 records in a vf page ...i think dis may b useful

 

 

vf page:

<apex:page sidebar="false" standardController="Department__c" recordSetVar="records" extensions="PageDataClass">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection >
<apex:pageBlockTable value="{!records}" var="r">
<apex:column headerValue="Name">
{!r.Name}
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
<apex:commandLink value="previous" action="{!previous}"/> |&nbsp;
<apex:commandLink value="next" action="{!next}"/>
</apex:pageBlock>
</apex:form>
</apex:page>


controller:

public with sharing class PageDataClass {
public PageDataClass(ApexPages.StandardSetController controller) {
controller.setpagesize(1000);
}
}

 

 

 

Regards,

 

ram.

==================================

nagalakshminagalakshmi

Hi, 

 

Thanks for your reply. But i am using the select options. How can i achieve this.

nagalakshminagalakshmi

Hi, 

 

Can you provide the sample code. Thanks in advance.

 

 

Thanks,

Lakshmi.

ram1234ram1234

i think this is ur requirement....................

 

<apex:page sidebar="false" controller="accPickNamesDisplayClass">

<apex:form >
<apex:selectList multiselect="false" size="1">
<apex:selectOptions value="{!accNames}">
</apex:selectOptions>
</apex:selectList>
</apex:form>
</apex:page>

 

 

controller:

 

public with sharing class accPickNamesDisplayClass {
List<selectOption> options = new List<selectOption>();
public List<selectOption> getAccNames() {
for(account acc : [select Id,name from account])
{
options.add(new selectOption(acc.name,acc.name));
}
return options;
}

}

====================================================

Ankit AroraAnkit Arora

If you want to display more than 1000 record in select list then am sorry it is not possible as this is a limitation of salesforce.

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

bruceyue1bruceyue1
// the picklist values can not exceed 1000, so we should use this method to bind a repeat component to show more than 1000 records.
public List<List<SelectOption>> getCorporateLists()
{
   List<List<SelectOption>> allOptions = new List<List<SelectOption>>();
   List<SelectOption> listOptions = getCorporateItems();
   List<SelectOption> temp = new List<SelectOption>();
   for(SelectOption op : listOptions)
   {
       if(temp.size() == 1000)
       {
           allOptions.add(temp);
           temp = new List<SelectOption>();  
       }
       temp.add(op);       
   }
   if(temp.size() > 0)
   { 
       allOptions.add(temp);
   }
   return allOptions;   
}
 
    public List<SelectOption> getCorporateItems()
    {
        List<SelectOption> options = new List<SelectOption>();
   options.add(new SelectOption('',' '));
   for(Corporate__c corporate : [select Id, Name, Code__c from Corporate__c where Code__c != null order by Name]) 
   {
       options.add(new SelectOption(corporate.Code__c, corporate.Code__c));
   }
   return options;
    }

<select style="width:220px" onchange="document.getElementById('{!$Component.CorporateValue}').value=this.value;">
                  <apex:repeat value="{!CorporateLists}" var="Lists">
                      <apex:repeat value="{!Lists}" var="list">                                    
                          <option value="{!list.value}">{!list.Label}</option>
                      </apex:repeat>
                  </apex:repeat>
      </select>
      <apex:inputHidden id="CorporateValue" value="{!EditingRule.Corporate}"/>