Visualforce Standard Controller :In our previous Salesforce Tutorial we have learned about different visualforce controllers. In this Salesforce developer Training Tutorial we are going to learn about Visualforce Standard Controller and it’s working with a single record and with multiple records.
As already we have learned about Visualforce Standard controller. Here we clearly study on standard controllers working with single record and Standard Controller working with multiple records with screen shots and apex programming.
Visualforce Standard Controller
Standard Controller working with a Single Record.
In salesforce.com visualforce page can be created in two ways. We can create Visualforce page by directly entering URL on the browser Ex:- https://ap1.salesforce.com/apex/mydemopage. We have to append /apex/mydemopage as shown below.
To open Visualforce page directly in edit mode we have to use https://ap1.salesforce.com/apex/mydemopage?id=O6690000004mjya. We have to append ?=15digit Id number of the visualforce page to open in edit mode.
Standard Controller provides different actions to access current visualforce page. Some of the actions provided by standard controller are.
- To view current visualforce project we use {!project__c}.
- To access data of the current record we use {!id}, {!object}.
- For navigation we use {!cancel}, {!edit}, {!view} for cancel, view and edit a record.
- For action and navigation actions like delete and save we use {!delete}, {!save}.
- To save current record with out navigation we use {!quicksave}.
Standard Controller working with multiple records.
In above example we have seen standard controller working with a single record. In this example we see how standard controller works with multiple records.
To operate on set of records standard set controller exists. recordsetVar attribute is used to obtain a list of project records, sorted by the first column etc.