In my vf page the date is presented based on only one value of the status picklist for the opportunists object.
Now i need to extend my search criteria in such as way that rather than selecting only one stagename, i need to pass multi select picklist value to query such that it can select any multi value from front end to soql query
I tried passing the stagename fields is only picklist and even i try to pass a multi select value to query i
Vf Page
<apex:page controller="Pagination_min">
<apex:form >
<apex:pageBlock id="pb">
<apex:pageBlockSection >
<apex:selectList value="{!shiftType}" multiselect="false" size="1"
label="Shift Types" title="Users" onchange="show()" >
<apex:selectOption itemValue="Closed Won" itemLabel="Closed Won"/>
<apex:selectOption itemValue="Closed Lost" itemLabel="Closed lost"/>
<apex:selectOption itemValue="Needs Analysis" itemLabel="need"/>
<apex:selectOption itemValue="Qualification" itemLabel="Qualification"/>
</apex:selectList>
</apex:pageBlockSection>
<apex:pageBlockTable value="{!Accounts}" var="a">
<apex:column value="{!a.Name}"/>
<apex:column value="{!a.closeDate}"/>
<apex:column value="{!a.stageName}"/>
</apex:pageBlockTable>
<apex:panelGrid columns="7">
<apex:commandButton status="fetchStatus" reRender="pb" value="|<" action="{!setCon.first}" disabled="{!!setCon.hasPrevious}" title="First Page"/>
<apex:commandButton status="fetchStatus" reRender="pb" value="<" action="{!setCon.previous}" disabled="{!!setCon.hasPrevious}" title="Previous Page"/>
<apex:commandButton status="fetchStatus" reRender="pb" value=">" action="{!setCon.next}" disabled="{!!setCon.hasNext}" title="Next Page"/>
<apex:commandButton status="fetchStatus" reRender="pb" value=">|" action="{!setCon.last}" disabled="{!!setCon.hasNext}" title="Last Page"/>
<apex:outputText >{!(setCon.pageNumber * size)+1-size}-{!IF((setCon.pageNumber * size)>noOfRecords, noOfRecords,(setCon.pageNumber * size))} of {!noOfRecords}</apex:outputText>
<apex:commandButton status="fetchStatus" reRender="pb" value="Refresh" action="{!refresh}" title="Refresh Page"/>
<apex:actionFunction name="show" action="{!refresh}" reRender="pb" />
<apex:selectList value="{!size}" multiselect="false" size="1" onchange="show()">
<apex:selectOptions value="{!items}"/>
</apex:selectList>
<apex:outputPanel style="color:#4AA02C;font-weight:bold">
<apex:actionStatus id="fetchStatus" startText="Fetching..." stopText=""/>
</apex:outputPanel>
</apex:panelGrid>
<apex:actionFunction name="show" action="{!refresh}" reRender="pb" />
</apex:pageBlock>
</apex:form>
public with sharing class Pagination_min {
public String shiftType { get; set; }
Public Integer noOfRecords{get; set;}
Public Integer size{get;set;}
public boolean test = false;
public Pagination_min() {
shiftType='Closed Won';
refresh();
}
public ApexPages.StandardSetController setCon {
get{
if(setCon == null){
if(test == false){
size = 10;
}
string queryString = 'Select Name, closeDate, stageName
from Opportunity where stageName =:shiftType order by Name';
setCon = new ApexPages.StandardSetController(Database.getQueryLocator(queryString));
setCon.setPageSize(size);
noOfRecords = setCon.getResultSize();
test = true;
}
return setCon;
}set;
}
Public List<Opportunity> getAccounts(){
List<Opportunity> accList = new List<Opportunity>();
for(Opportunity a : (List<Opportunity>)setCon.getRecords())
accList.add(a);
return accList;
}
public pageReference refresh() {
setCon = null;
getAccounts();
setCon.setPageNumber(1);
return null;
}
public List<SelectOption> getItems() {
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('10','10'));
options.add(new SelectOption('20','20'));
options.add(new SelectOption('30','30'));
return options;
}
}