• #11273
    Salesforce | Ajit Ajit #399
    Forcetalks

    Difference between actionPoller, actionSupport, actionFunction and actionRegion

    I want a detailed difference between actionPoller, actionSupport, actionFunction and actionRegion.

     

    #12479
    Salesforce | Surbhi Surbhi #389
    Forcetalks

    Hi Ajit,

    actionFunction: It is used to call the server side method using javaScript.

    actionSupport: It is used to call the server based on the client side event i.e. like onclick ,onchange..etc.

    actionPoller: It is used to call the server side method in a regular interval of time.

    actionRegion : An area of a Visualforce page that demarcates which components should be processed by the Force.com server when an ajax request is generated.

    Thanks

    #34603
    Salesforce | shariq shariq #1
    Forcetalks

    Hi,

    apex:ActionFunction : This component helps to envoke AJAX request (Call Controllers method) directly from Javascript method. It must be child of apex:form.
    <apex:actionFunction name=”sendEmail” action=”{!sendEmailFunction}”>

    </apex:actionFunction>

    apex:ActionSupport : This component adds Ajax request to any other Visualforce component. Example : Commandlink button has inbuilt AJAX functionality however few components like OutputPanel does not have inbuilt AJAX capabilities. So with the help of this component, we can enable AJAX.

    <apex:outputpanel id=”counter”>
    <apex:outputText value=”Click Me!: {!count}”/>
    <apex:actionSupport event=”onclick” action=”{!incrementCounter}” rerender=”counter” status=”counterStatus”/>
    </apex:outputpanel>

    apex:ActionPoller : This is timer component which can send AJAX request on pre-defined interval. Minimum interval is 5 sec and default is 60 sec.
    <apex:actionPoller action=”{!incrementCounter}” rerender=”counter” status=”counterStatus” interval=”50″ />

    actionRegion : An area of a Visualforce page that demarcates which components should be processed by the Force.com server when an ajax request is generated.

    Similarities:

    Both action support and function can be used to call a controller method using an AJAX request.

    Differences:
    1. Action function can call the controller method from java script.
    2. Action support adds AJAX support to another visualforce component and then call the controller method.
    for example:
    <apex:outputpanel id=”outptpnl”>
    <apex:outputText value=”click here”/>
    <apex:actionSupport event=”onclick” action=”{!controllerMethodName}” rerender=”pgblck” />
    </apex:outputpanel>
    Here action support adds AJAX to output panel, so once you click on output panel controller method will be called.

    3. Action function cannot add AJAX support to another component. But from a particular component which has AJAX support(onclick, onblur etc) action function can be called to call the controller method.
    Example:
    <apex:actionFunction name=”myactionfun” action=”{!actionFunMethod}” reRender=”outptText”/>
    <apex:inputcheckbox onclick=”myactionfun” />
    In this example onlick of input checkbox “myactionfun” action function is called from where controller method “actionFunMethod” gets called.

    Apart from this, the main difference between the “two” action support and action function is that, the action function can also be called from java script.
    Example:
    <apex:actionFunction name=”myactionfun” action=”{!actionFunMethod}” reRender=”outptText”/>
    <apex:inputcheckbox onclick=”myJavaMethod()” />
    <script>
    function myJavaMethod(){
    myactionfun();// this call the action function
    }
    </script>

    Hope this helps.

    #34685
    Salesforce | Parul Parul #2
    Forcetalks

    These are the AJAX action tags that support the calling of action and refresh the field only not the entire Visualforce page.

    1. <apex:actionFunction> – Provides support for invoking controller action methods directly from JavaScript code using an AJAX request. An <apex:actionFunction> component must be a child of an <apex:form> component.

    2. <apex:actionPoller> –  A timer that sends an AJAX update request to the server according to a time interval that you specify. Update request can then result in a full or partial page update. You should avoid using this component with enhanced lists.

    3. <apex:actionStatus> –  A component that displays the status of an AJAX update request. An AJAX request can either be in progress or complete

    4. actionRegion : An area of a Visualforce page that demarcates which components should be processed by the Force.com server when an ajax request is generated.

     

    THanks

Viewing 4 posts - 1 through 4 (of 4 total)

Please to reply to this topic.

CONTACT US

We're not around right now. But you can send us an email and we'll get back to you, asap.

Sending

About Us

Forcetalks is a Salesforce collaboration platform for coders & developers, geeks & nerds, consultants & business heads, admins & architects, managers & marketers and of course the business owners. A community where you can learn from, where you can contribute to. For you. For Salesforce. Read More...

Copyright 2018 Forcetalks. All Right Reserved.

Log in with your credentials

or    

Forgot your details?