public class ListOfEditionOpportunity { public List<Edition__c> accList {get; set;} public string SelectedEdition {get;set;} public List opptyList {get; set;} List myProduct{get;set;} public List getEditionList(){ List listValue = new List(); listValue.add(new SelectOption('','--None--')); for(Edition__c L:accList){ listValue.add(new SelectOption(l.id,l.name)); } return listValue; } //Method to get Opportunity List Detail public List getOpptyRecord(){ List myOpp = new List([select id,Name,Account.name, RecordType.Name,CloseDate,StageName, Account_Owner_Formula__c,CreatedDate from Opportunity WHERE Edition__r.id = :SelectedEdition ]); return myOpp; } public pageReference getDetails(){ opptyList = new List(); for(Opportunity o:getOpptyRecord()){ opptyList.add(o); } return null; }
public class ListOfEditionOpportunity {
public List<Edition__c> accList {get; set;}
public string SelectedEdition {get;set;}
public List<Opportunity> opptyList {get; set;}
List<OpportunityLineItem> myProduct{get;set;}
public List<SelectOption> getEditionList(){
List<SelectOption> listValue = new List<SelectOption>();
listValue.add(new SelectOption('','--None--'));
for(Edition__c L:accList){
listValue.add(new SelectOption(l.id,l.name));
}
return listValue;
}
//Method to get Opportunity List Detail
public List<Opportunity> getOpptyRecord(){
List<Opportunity> myOpp = new List<Opportunity>([select id,Name,Account.name,
RecordType.Name,CloseDate,StageName,
Account_Owner_Formula__c,CreatedDate
from Opportunity WHERE Edition__r.id = :SelectedEdition ]);
return myOpp;
}
public pageReference getDetails(){
opptyList = new List<Opportunity>();
for(Opportunity o:getOpptyRecord()){
opptyList.add(o);
}
return null;
}
// Constructor of Class
public ListOfEditionOpportunity(apexPages.StandardController controller){
opptyList = new List<Opportunity>();
accList = new List<Edition__c>([SELECT Id,Name FROM Edition__c]);
SelectedEdition = '';
}
}
}
<apex:page standardController="Opportunity" extensions="ListOfEditionOpportunity" tabStyle="Edition__c">
<apex:page standardController="Opportunity" extensions="ListOfEditionOpportunity" tabStyle="Edition__c">
<apex:form >
<apex:pageBlock title="All Edition Details">
<apex:outputLabel ><H2>Select Edition From the List</H2></apex:outputLabel>
<apex:selectList value="{!SelectedEdition}" size="1">
<apex:selectOptions value="{!EditionList}"/>
<apex:actionSupport action="{!getDetails}" event="onchange" id="PBS2"/>
</apex:selectList>
</apex:pageBlock>
<apex:pageblock >
<apex:pageblockSection id="PBS1" title="List of Opportunity " collapsible="false" columns="1" >
<apex:pageblockTable value="{!opptyList}" Var="o" Width="100%">
<apex:column HeaderValue="Action">
<apex:commandLink value="Edit" action="{!URLFOR($Action.Opportunity.Edit,o.id)}"/>
<apex:commandLink value="Delete" action="{!URLFOR($Action.Opportunity.Delete,o.id)}" />
</apex:column>
<apex:column headerValue="Opportunity Name">
<apex:outputLink value="/{!o.id}">{!o.name}</apex:outputLink>
</apex:column>
<apex:column HeaderValue="Account Name">
<apex:outputLink value="/{!o.AccountId}">{!o.Account.Name}</apex:outputLink>
</apex:column>
<apex:column HeaderValue="Opportunity Record Type" value="{!o.RecordType.Name}"/>
<apex:column HeaderValue="Close Date" value="{!o.CloseDate}"/>
<apex:column headerValue="Stage Name" value="{!o.StageName}"/>
<apex:column HeaderValue="Account Owner Formula" value="{!o.Account_Owner_Formula__c}"/>
<apex:column HeaderValue="Created Date" value="{!o.CreatedDate}"/>
</apex:pageblockTable>
</apex:pageblockSection>
</apex:pageblock>
</apex:form>
</apex:page>
</apex:form> </apex:page>