You need to sign in to do that
Don't have an account?
StandardSetController & VisulaForce
Hello Expert,
I have just joined the Salesforce, and stuck in this question
I have to create a visual force page with BillingCity, BillingState and BillingCountry and a search button, based on the filter i have to display the records on the vf page.
Below is code for the visual force page
<apex:page StandardController="Account" extensions="AccountExtension">
<apex:form>
<apex:pageBlock id="in" title="Populate 100 Entried based on select Criteria" >
<apex:pageBlockButtons location="top">
<apex:commandButton value="search" action="{!getAccountExtension}" rerender="out, in" status="status">
</apex:commandButton>
</apex:pageBlockButtons>
<apex:pageBlockSection>
<apex:inputField value="{!account.BillingState}"/>
<apex:inputField value="{!account.BillingCity}"/>
<apex:inputField value="{!account.BillingCountry}">
</apex:inputField>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
<apex:pageBlock id ="out" title=" Out put">
<apex:actionStatus startText="updatign .... " id ="status"/>
<apex:pageBlockSection>
<apex:pageBlockTable value="{!accountRecords}" var="ac">
<apex:column headervalue="Owner Name" value="{!ac.account.Name}"/>
<apex:column headervalue = " Billing city " value="{!ac.BillingCity}"/>
<apex:column headervalue = " Billing State " value="{!ac.BillingState}"/>
<apex:column headervalue = " Billing Country" value="{!ac.BillingCountry}"/>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:page>
Below is the code for AccountExtension
public class AccountExtension {
private Account account {get;set;}
public AccountExtension(ApexPages.StandardController controller){
this.account = (Account)controller.getRecord();
}
public ApexPages.StandardSetController accountRecords{
get{
if(accountRecords==null){
return new ApexPages.StandardSetController(Database.getQueryLocator([Select Name,
BillingCity,
BillingState,
BillingCountry
from Account
where BillingCountry like :account.BillingCountry
and BillingCity like :account.BillingCity
and BillingState like :account.BillingState
limit 100
]));
}
return accountRecords;
}
private set;
}
public List<Account> getAccountExtension(){
return (List<Account>) accountRecords.getRecords();
}
}
I am not able to use accountRecords in the <apex:pageTable>.
Kindly suggest the way to display the records on the vf page, using the filter created.
Any help will be appreciated
I have just joined the Salesforce, and stuck in this question
I have to create a visual force page with BillingCity, BillingState and BillingCountry and a search button, based on the filter i have to display the records on the vf page.
Below is code for the visual force page
<apex:page StandardController="Account" extensions="AccountExtension">
<apex:form>
<apex:pageBlock id="in" title="Populate 100 Entried based on select Criteria" >
<apex:pageBlockButtons location="top">
<apex:commandButton value="search" action="{!getAccountExtension}" rerender="out, in" status="status">
</apex:commandButton>
</apex:pageBlockButtons>
<apex:pageBlockSection>
<apex:inputField value="{!account.BillingState}"/>
<apex:inputField value="{!account.BillingCity}"/>
<apex:inputField value="{!account.BillingCountry}">
</apex:inputField>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
<apex:pageBlock id ="out" title=" Out put">
<apex:actionStatus startText="updatign .... " id ="status"/>
<apex:pageBlockSection>
<apex:pageBlockTable value="{!accountRecords}" var="ac">
<apex:column headervalue="Owner Name" value="{!ac.account.Name}"/>
<apex:column headervalue = " Billing city " value="{!ac.BillingCity}"/>
<apex:column headervalue = " Billing State " value="{!ac.BillingState}"/>
<apex:column headervalue = " Billing Country" value="{!ac.BillingCountry}"/>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:page>
Below is the code for AccountExtension
public class AccountExtension {
private Account account {get;set;}
public AccountExtension(ApexPages.StandardController controller){
this.account = (Account)controller.getRecord();
}
public ApexPages.StandardSetController accountRecords{
get{
if(accountRecords==null){
return new ApexPages.StandardSetController(Database.getQueryLocator([Select Name,
BillingCity,
BillingState,
BillingCountry
from Account
where BillingCountry like :account.BillingCountry
and BillingCity like :account.BillingCity
and BillingState like :account.BillingState
limit 100
]));
}
return accountRecords;
}
private set;
}
public List<Account> getAccountExtension(){
return (List<Account>) accountRecords.getRecords();
}
}
I am not able to use accountRecords in the <apex:pageTable>.
Kindly suggest the way to display the records on the vf page, using the filter created.
Any help will be appreciated
Try the below link.
http://gtr.net/how-to-build-a-simple-search-page-using-visualforce/
All Answers
Try the below link.
http://gtr.net/how-to-build-a-simple-search-page-using-visualforce/