function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
peterg012peterg012 

Custom Component Query

Hi Guys,

 

Is it possible to have a Custom VF component that generates an select list, then when using the component on a VF page it returns / binds the select option value to a custom controller that the VF page is using.

 

The controller that the component uses to generate the select list etc, is different from the controller that the VF page is using.

 

Hope this makes sense?  Thanks in advance.

 

Peter

sfdcfoxsfdcfox

Yes, you can pass a SelectOption[] to a component element, and it will render as you expect. To return a value, bind the parameter to writable element:

 

<c:mycomponent options="{!optionList}" value="{!controller.componentValue}" />

Where controller is the page's controller (not the component), componentValue is a legal member or getter/setter combination, and optionList returns a SelectOption[].