Asynchronous Actions

So far, you’ve built Visualforce pages that have a simple interaction with their controller. They display data from the controller, potentially allowing the user to change it, and then submit it using an action component such as a commandButton. The action component invokes a method on the controller that returns a PageReference, navigating the user to a new page or refreshing the current page.

Visualforce actions also support more complex, asynchronous interactions with the page, commonly referred to as Ajax. Ajax is short for Asynchronous JavaScript and XML. Visualforce supports Ajax in two ways:

1. It allows actions to run in the background. The user is free to continue working with the page while Force.com processes the result. For example, a duplicate checking algorithm could examine the page while the user is inputting data, flagging duplicate records as they are discovered.

2. Actions can refresh a subset of the Visualforce page, such as a table of data, rather than the entire page. This can create a richer, more interactive experience for users and often better-performing pages.

This section explains how to add Ajax behavior to Visualforce pages. It includes the following subsections:

Image Partial page refresh—Refresh selected elements on the page rather than the whole page.

Image Action as JavaScript function—Define a JavaScript function that calls an action method on the controller.

Image Action as timed event—Configure an action method to fire at a predefined time interval.

Image Action as JavaScript event—Bind a JavaScript event (such as onclick) to a controller action method.

Image Indicating action status—Reflect the status of an asynchronous action on the page.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.173.78