Tuesday, June 27, 2017

Visual force page:


What are the Standard List Controller Actions?


Action methods perform logic or navigation when a page event occurs, such as when a user clicks a button, or hovers over an area of the page. Action methods can be called from page markup by using {! } notation in the action parameter of one of the following tags:

• <apex:commandButton> creates a button that calls an action

• <apex:commandLink> creates a link that calls an action

• <apex:actionPoller> periodically calls an action

• <apex:actionSupport> makes an event (such as “onclick”, “onmouseover”, and so on) on another, named component,
call an action

• <apex:actionFunction> defines a new JavaScript function that calls an action

• <apex:page> calls an action when the page is loaded

The following table describes the action methods that are supported by all standard list controllers. You can associate these actions with any Visualforce component that includes an action attribute.

Action
Description
save
Inserts new records or updates existing records that have been changed. After this operation is finished, the save action returns the user to the original page, if known, or the home page.
quicksave
Inserts new records or updates existing records that have been changed. Unlike the save action, quicksave does not redirect the user to another page.
list
Returns a PageReference object of the standard list page, based on the most recently used list filter for that object when the filterId is not specified by the user.
cancel
Aborts an edit operation. After this operation is finished, the cancel action returns the user to the page where the user originally invoked the edit.
first
Displays the first page of records in the set.
last
Displays the last page of records in the set.
next
Displays the next page of records in the set.
previous
Displays the previous page of records in the set.

In the following example, the user specifies a filter for viewing account records. When the user clicks Go, the standard list page displays, using the selected filter.

<apex:page standardController="Account" recordSetVar="accounts">
<apex:form>
<apex:selectList value="{!filterid}" size="1">
<apex:selectOptions value="{!listviewoptions}"/>
</apex:selectList>
<apex:commandButton value="Go" action="{!list}"/>
</apex:form>
</apex:page>

What is Standard List controller in Visuaforce?


Standard list controllers allow you to create Visualforce pages that can display or act on a set of records. Examples of  work with a set of records include list pages, related lists, and mass action pages. Standard list controllers can be used with the following objects:



• Account

• Asset
• Campaign
• Case
• Contact
• Contract
• Idea
• Lead
• Opportunity
• Order
• Product2
• Solution
• User
• Custom objects


For example, to associate a page with the standard list controller for accounts, use the following markup:

<apex:page standardController="Account" recordSetVar="accounts">

The recordSetVar attribute not only indicates that the page uses a list controller, it can indicates the variable name of the record collection. This variable can be used to access data in the record collection

Accessing Data with List Controllers

<apex:page standardController="Account" recordSetVar="accounts" tabstyle="account"
sidebar="false">
<apex:pageBlock >
<apex:pageBlockTable value="{!accounts}" var="a">
<apex:column value="{!a.name}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>


This results in a page that lists all the account names in your organization:


How to add visualforce page in home page in salesforce?

If you want add visualforce page to home please follow the below

Step 1:-


Setup-->Customize-->Home--> Home Page components
click on Home Page components
In custom components section click on New
Give the name you want
We can show four different components in that Choose Visualforce Area click next
Component Position: Wide (Right) Column
Visualforce Page : Graduate List
Height (in pixels): 400
click save

Step 2:-


Setup-->Customize-->Home-->Home Page Layouts
In Home Page Layouts click on default then click on edit
In Select Wide Components to Show section check the Graduate List
then click next and then save
now check it will display like below.

No comments:

Post a Comment