Controlling components

Components are not just for static markup. A component can have its own controller that enables users to interact with it. This is useful for web functions that occur on multiple screens, such as a search bar that only searches through records of the sObject in the standard controller. It's also useful for web functions that occur multiple times on a single page. A great example is uploading files. Normal behavior on the Salesforce1 Platform is to upload one file at a time. Most people are okay with this, but sometimes when you're uploading a long list of files, you might forget which ones you've already done. You could just use a Visualforce page with a bunch of <apex:inputFile> tags on it, but wouldn't it be so much cooler ...

Get Learning Apex Programming 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.