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
Vigneshwaran LoganathanVigneshwaran Loganathan 

Need help for following case,

I have record type which is having thousands of records, and i created picklist field to show Records per page ( Values having 10, 25, 50, 100 ). In this i am selecting the picklist value and hit GO button manually to show correponding Records per page. But what I want is when I choose value, it have to load dynamically ( automatically without hitting GO Button )  for the chosen value.  

Thanks in Advance.


 
nagalakshminagalakshmi
Hi,

Use <apex:actionsupport tag. Like

EX:

Class


public class picklistsearch
{
  public string searchtext{set;get;}
  list<lead> leadlist = new list<lead>();
public list<SelectOption> getitems()
{
List<SelectOption> options1 = new List<SelectOption>();
options1.add(new SelectOption('None','None')); 
options1.add(new SelectOption('Web','Web')); 
options1.add(new SelectOption('Phone Inquiry','Phone Inquiry'));
options1.add(new SelectOption('Partner Referral','Partner Referral'));
return options1;
}
public void search()
{
  leadlist.clear();
 for(Lead l : [select id,firstname,lastname,email,leadsource from lead where leadsource =: searchtext]) {
   leadlist.add(l);
 }

public list<lead> getleads()
{
  return leadlist;
}
}
Page:

<apex:page controller="picklistsearch">
  <apex:form >
   <apex:selectList value="{!searchtext}" size="1">
       <apex:selectOptions value="{!items}"/>
         <apex:actionSupport event="onchange" action="{!search}" />
    </apex:selectList> 
    <apex:pageBlock >
      <apex:pageBlockTable value="{!leads}" var="l">
        <apex:column value="{!l.firstname}"/>
        <apex:column value="{!l.lastname}"/>
        <apex:column value="{!l.email}"/>
        <apex:column value="{!l.leadsource}"/>
      
      </apex:pageBlockTable>
    </apex:pageBlock>
  </apex:form>
</apex:page>