Using wrapper classes
A common use case for Visualforce is to present a list of sObjects
, allowing a user to select a number of these, and then choose an action to apply to the selected entries. Marking an sObject
entry as selected presents a challenge, as it is associating transient information, the selected status, with a record persisted in the Salesforce database.
The solution is to use a wrapper class to encapsulate or wrap an sObject
instance and some additional information associated with the sObject
instance.
In this recipe, we will create a Visualforce page that presents a list of opportunity sObjects
, and allows the user to select a number of records to remove from the displayed list.
Getting ready
This recipe makes use of a wrapper class ...
Get Visualforce Development Cookbook - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.