apex:actionSupport tag - A SIMPLE EXAMPLE | Techila
2014
single,single-post,postid-2014,single-format-standard,ajax_updown_fade,page_not_loaded,,qode_grid_1300,footer_responsive_adv,hide_top_bar_on_mobile_header,qode-content-sidebar-responsive,qode-theme-ver-9.4.2,bridge,wpb-js-composer js-comp-ver-4.12,vc_responsive
 

apex:actionSupport tag – A SIMPLE EXAMPLE

ACTION SUPPORT TAG – A SIMPLE EXAMPLE

apex:actionSupport tag – A SIMPLE EXAMPLE

What is the purpose of Rerender??

Rerender is used when you want to refresh only a portion of your Visualforce page when the user does some action. This would actually improve the user interface and reduce processing time.

In this article we will go through a simple example which demonstrates the usage of these two attributes.

A small program:

Create a visualforce page with the following code.

<apex:page >

<apex:form>

   <apex:pageBlock>

       <apex:sectionHeader title=”Rerender Example”/>     

           <apex:commandButton value=”Move your mouse here to refresh the time!”>

               <apex:actionSupport event=”onmouseover” rerender=”time” status=”refreshstatus”/>

           </apex:commandButton>

           <apex:actionStatus id=”refreshstatus” startstyle=”color:green;” startText=”Refreshing….”></apex:actionStatus> 

           <apex:outputpanel id=”time”>

               <apex:outputtext value=”{!NOW()}”/>

           </apex:outputpanel> 

   </apex:pageBlock>

</apex:form> 

</apex:page>

Save the page and move your mouse across the button to see the results.

Understanding the code:

We will now analyze the code,

<apex:actionSupport event=”onmouseover” rerender=”time” status=”refreshstatus”/>

The event attribute determines which action should refresh the page, we have a onmouseover. That’s why when you move the mouse over the command button, the time gets refreshed.

The rerender attribute determines the portion of the page to be refreshed. We have “time” which is the ID of the portion to be refreshed.

The actionstatus attribute determines the status message to be displayed when the refresh takes place. We have “refreshstatus” which is the ID of the associated “actionstatus” tag.

Courtesy: http://www.forcetree.com/2009/10/rerender-and-actionsupport-simple.html

“Explore – Techila Global Services, A Salesforce development company”

Author: techila

No Comments

Post A Comment