+ Start a Discussion
Sandra WicketSandra Wicket 

Visualforce Page: Show Values without select

Hi there,
is it possible to show "All" values without the action "onchange" ? I want to see the values when i load the page and  when i select the item.

<apex:page controller="LeadPageControllerFilter" tabStyle="SalesFunnel__c">
      <apex:form >
        <apex:pageBlock title="Leads">
            <apex:pageBlockSection title="Meine Leads" columns="1">
                Select Industry to Filter list:
                <apex:selectList size="1" value="{!industryPickvalue}">
                    <apex:actionSupport event="onchange" action="{!getleads}" rerender="table1"/>
                    <apex:selectOption itemLabel="All" itemValue="All"></apex:selectOption> 
                    <apex:selectOption itemLabel="Value A" itemValue="Value A" ></apex:selectOption>
                    <apex:selectOption itemLabel="Value B" itemValue="Value B" >
                <apex:pageBlockTable id="table1" value="{!leadList}" var="l" columnsWidth="80%, 20%">
                    //columnsWidth="400px, 100px, 400px, 200px, 200px, 50px"                            
                    <apex:column >
                        <apex:facet name="header">Name</apex:facet>
                        <apex:outputLink value="/{!l.Id}" target="_blank">
                            <apex:outputField value="{!l.company}"/>
                    <apex:column value="{!l.Lead_Score__c}" />     

Thanks Guys  ;) 
Narveer SinghNarveer Singh
Hi EL,

You can use below sample code and change accordingly.For one object we can do like below and if you want to display data for more then one object you need to use Wrapper class concept.For Select Option we can use method as well.Below is the code for Select OPtion vf and Sample controller:

Controller :

public with sharing class LeadPageControllerFilter {

    public String varriable1{get;set;}
    public Integer varriable2{get;set;}
    public List<SelectOption> getleads() {
        List<SelectOption> options = new List<SelectOption>();
        for(Lead taskstatus : [SELECT Status FROM Lead LIMIT 15]){
            options.add(new SelectOption(taskstatus.ID,taskstatus.ID));
        return options;
    public List<Lead> getLead() {
        String strQry = 'Select ID From Lead';
        List<Lead> leadList = new List<Lead>();
        for(Lead led :  Database.query(strQry)){
        return leadList;

VF Page :

<apex:selectList value="{!Country}">
    <apex:actionSupport event="onchange" />
    <apex:selectOptions value="{!leads}" />

Hope this helps you!

Please accept my solution as Best Answer if my reply was helpful. It will make it available for other as the proper solution.Let me know if anything else.

Best Regards

Sandra WicketSandra Wicket
Thanks Narveer,
is there no other solution ? I thought i only have to change the actionSupport event or sth. My Page works fine, but i want to see the values of the filter by change and when i refresh the page.