I'm having issues with passing parameters to my vf page. I've tried doing something similar with communicating between component and visualforce page in this example: How do I pass a parameter from component to a Visualforce page?

Here is snippets of code of what I've tried. And I'm not getting back anything.

public with sharing class CLSearchDataClass {

    public account acctData{get; set;}
    public Id acctId {get; set;}

Page Controller init:
public with sharing class SGIConvertLeadClass {  
   public CLSearchDataClass theAcctSC{
            return theAcctSC; 

Component attribute and use:
<apex:component controller="AccountSearchController" >
    <apex:attribute type="CLSearchDataClass" name="accData" required="true" description="Account Data" assignTo="{!aData}"/>
        <apex:pageBlockTable value="{!acctWrapList}" var="acctWrap" align="top">
            <apex:column >
                <apex:inputCheckbox id="selectAccountRow" value="{!acctWrap.isSelected}" >
                    <apex:actionSupport event="onclick" action="{!selectAcct}" reRender="accountFieldPanel, convertLeadPanel"/>

//we have a seaerch function in the component that is populated through a wrapper class and we are able to select the returned search results through a list of wrappers in the pageBlockTable that can be selected

Component Controller: 
public with sharing virtual class AccountSearchController {

    // the soql without the order and limit
    private String soql {get;set;}
    // the collection of account to display
    public List<Account> accounts {get;set;}
    //WrapperClass list for accounts searched
    public List<accountWrap> acctWrapList {get; set;}
    //Data class to pass objects to another page/controller
    public CLSearchDataClass aData {get; set;}

    public void selectAcct(){
        aData = new CLSearchDataClass();
        for (accountWrap aWrapper : acctWrapList){
            if (aWrapper.isSelected ){
               aData.acctId = aWrapper.oAccount.Id;
                aData.acctData = aWrapper.oAccount;
                aData.acctId = null;
                aData.acctData= null;

VF page pass the data class 
                <apex:outputPanel id="accountSearchPanel">
                    <apex:pageBlockSection title="Existing Account Search" columns="1" id="acctSearhSection" rendered="{!acctCreate}">
                        <apex:actionRegion >
                            <c:AccountSearchComponent accData="{!theAcctSC}" id="acctSearch" rendered="{!acctCreate}" idOfSection="SGIconvertLead.accountFieldPanel"></c:AccountSearchComponent>

I bet it's an issue with the order of execution. Note that the constructor is getting called before the setter methods. Have a look at this answer and I hope that will give you a better understanding of how the order of execution works in VF.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.