+ Start a Discussion
Jake GmerekJake Gmerek 

Looking for an idea

Recently I posted a question about the apex:relatedList tag.  Since that tag would not do what I needed it to do, I thought about making a custom component that worked like i need it to.  Here is what it should look like in practice:

 

<c:CustomRelatedList objectType="opportunity" fields="ID,Name"  relatedField="Account"></c:CustomRelatedList>

 

The assumption in this case is that this would be on a VF page that was displaying an account record, it would display a related list of opportunities using the fields in the fields attribute and where the relatedField = theCurrentAccountID.

 

I started implementing this using a controller and dynamic VF in Apex, and I can even create the query and display the results to an extent.  But what I am running into is that the attributes are not set in the controller until after the custom component is rendered.  What that means is that I have no way of dynamically determining the number of colums or even of setting the column headings because there does not seem to be a way to access the data from the custom component attributes when I need to.

 

I am looking for ideas on how to get the appropriate data into the controller earlier.  My only thought on this right now is to change the attributes of the custom controller to URL parameters and access them that way, but I feel that that set up is less ideal and could limit the usability of the component in the future.  Any other ideas?

 

Thanks