• Adam Lee 22
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
Hi guys. Hope you can advice me.

On my VF section on the page layout, I have managed to get it to display the list. However, the filter (input field) does not work. e.g. When I select "Jan", I want just the records for Jan to display.

User-added image

VF
<apex:page Controller="AccountBrokerGWP" showHeader="True" sidebar="True"> 
    <apex:form >
        <apex:outputPanel id="pnlAll">
      <apex:pageBlock >
          
            <apex:pageblockSection title="Forecasts" collapsible="false" columns="1">
                 
                
                <apex:inputField value="{!forecastMonth.Broker_BPMonth__c}" >
                            <apex:actionSupport event="onchange" status="refreshstatus2" action="{!BPMonth}" reRender="pnlAll"/>
                        </apex:inputField>
                <apex:facet name="header">
                                <apex:outputText value="Forecasts"></apex:outputText>
               			 
                                </apex:facet>
               
                            </apex:pageblockSection>
 
          <apex:pageBlockTable id="table" value="{!ForecastListWrap}" var="BPWrap"  title="All Forecasts" columnsWidth="40px, 40px, 40px, 40px, 40px, 40px, 40px">
			<apex:column headervalue="GWP Forecasts" >
                    	<apex:outputLink value="{!URLFOR($Action.Business_Planning__c.View, BPWrap.BP.id)}" target="_parent">{!BPWrap.BP.Name}</apex:outputLink>
                    </apex:column>				   
                                   
              
			<apex:column value="{!BPWrap.BP.Broker_BPMonth__c}" headerValue="Month" />
            <apex:column value="{!BPWrap.BP.Broker_BP_Planned_GWP__c}" headerValue="Planned GWP" />
            <apex:column value="{!BPWrap.BP.Broker_BP_Actual_GWP__c}" headerValue="Actual GWP" />                   
              </apex:pageBlockTable>
                                      
          </apex:pageBlock>
        </apex:outputPanel>
          
    </apex:form>
    
</apex:page>
Controller
public with sharing class AccountBrokerGWP {

    public Business_Planning__c GWPForecast {get; set;}
    public ID idAcc = ApexPages.currentPage().getParameters().get('id');
    public String fMonth= ApexPages.currentPage().getParameters().get('Broker_BPMonth__c');
    public Boolean  showGWPforecast {get; set;}
    public Boolean ownForecasts {get; set;}
    public Business_Planning__c BPDetails {get; set;}
    public Business_Planning__c forecastMonth {get; set;}
    public Business_Planning__c getBP() {
        return forecastMonth;
    }
    public Boolean ExpandedView {get; set;}
    private Integer noGWPforecast {get; set;}
    public String pnlHeight {get; set;}
    private final Account acc;
    
 

    public AccountBrokerGWP(ApexPages.StandardController controller){
        this.acc = (Account) controller.getRecord();
        showGWPforecast=true;
        
    ownForecasts = True;
    String strOwnforecasts = ApexPages.currentPage().getParameters().get('OwnForecasts');
    ownForecasts = (strOwnForecasts == null) ? true : Boolean.ValueOf(strOwnForecasts);

        forecastMonth = new Business_Planning__c(Broker_BPMonth__c='');
        
    }   
    
    public void BPMonth(){  
        ownForecasts = True;
    }
    
 private final Account Account;
   
    public Account getAccount() {
        return Account;   
    }
    
     public class wrapForecast {
        public Business_Planning__c BP {get; set;}
        public Boolean selected {get; set;}
        
        public wrapForecast(Business_Planning__c r) {
            BP = r;
            selected = false;
        }

    }

    public List<wrapForecast> ForecastListWrap {get; set;}
    

   public AccountBrokerGWP(){
 
        Account = [Select Id, Name FROM Account
            WHERE Id = :ApexPages.currentPage().getParameters().get('id')];
        
        if(ForecastListWrap == null){
            ForecastListWrap = new list <wrapForecast>();
            
            for(Business_Planning__c b: [Select Id, Broker_BPMonth__c,
            Broker_BP_Planned_GWP__c, Broker_BP_Actual_GWP__c, Name,  Broker_to_Target__c FROM Business_Planning__c
            WHERE Account__c = :idAcc])
            {
                ForecastListWrap.add(new wrapForecast(b));
            }
               
               
        }
    }

   

}


Any ideas? Ive spent hours on this and Im new to VF and APEX.

Thanks