+ Start a Discussion
ministe2003ministe2003 

ActionSupport inside Custom Component

Hi all,

I'm writing a custom component which is basically a select list with all the ajax refresh functionality built in, to save having to write a pageblock section item with an output panel in it, with a select list in that etc etc.

 

I have an ActionSupport within my component, like so:

 

 

<apex:component >

<apex:attribute name="fieldLabel" description="Output label text value."
type="String" required="true"/>
<apex:attribute name="fieldValue" description="The object field we are filling in."
type="String" required="true"/>
<apex:attribute name="SelectOptionsList" description="List of SelectOptions components."
type="String" required="true"/>
<apex:attribute name="actionPerformed" description="Action performed by the ActionSupport."
type="String" required="false"/>
<apex:attribute name="reRenderBlock" description="Section on the page to reRender"
type="String" required="true"/>

<apex:outputlabel value="{!fieldLabel}"/>
<apex:panelGroup >
<apex:selectList value="{!fieldValue}" size="1">
<apex:selectoptions value="{!SelectOptionsList}"/>
<apex:actionSupport action="{!actionPerformed}" event="onchange" reRender="{!reRenderBlock}" status="status1"/>
</apex:selectList>
<apex:actionstatus id="status1">
<apex:facet name="start">
<apex:image url="/img/loading24.gif" rendered="true"/>
</apex:facet>
</apex:actionstatus>
</apex:panelGroup>

</apex:component>

 

I want {!actionPerformed} to be the action that the ActionSupport runs but because I will be using this component in lots of places, it needs to be selected by the user by an attribute.  When I put the component in the page, like so:

 

 

<c:ajaxSelectList fieldLabel="Product Family" fieldValue="{!imrf.Product_Family__c}" selectOptionsList="{!ProdFamilyPicklist}"
                                    actionPerformed="{!updateFieldValues}" reRenderBlock="refreshMe" />

 

 

I get this error:

 

 

Error: Unknown property 'IMRFNewEditController.updateFieldValues'	
Quick Fix	Create Apex property 'IMRFNewEditController.updateFieldValues'
Quick Fix	Create Apex method 'IMRFNewEditController.getUpdateFieldValues'

 

 

The issue is that it thinks im passing through a property, not a method call.  The method is in the class, it is actually used here in the original full form of the selectlist, for example:

 

 

<apex:pageblocksectionItem >
                    <apex:outputlabel value="Product Family"/>
                    <apex:panelGroup >
                        <apex:selectList value="{!imrf.Product_Family__c}" size="1">
                            <apex:selectoptions value="{!ProdFamilyPicklist}"/>
                            <apex:actionSupport action="{!updateFieldValues}" event="onchange" reRender="refreshMe" status="status1"/>
                        </apex:selectList>
                        <apex:actionstatus id="status1">
                                <apex:facet name="start">
                                    <apex:image url="/img/loading24.gif" rendered="true"/>
                                </apex:facet>
                        </apex:actionstatus>
                    </apex:panelGroup>
                </apex:pageblocksectionItem>

 

How can I make the component attribute accept my method call?  Cant find any examples of this so maybe it just isnt possible, which would be disappointing!

 

Thanks

Steven