Wednesday, June 18, 2014

How to use apex:column in Visualforce Page?

How to use <apex:column>  in Visualforce Page?

<apex:column>:
A single column in a table. An < apex:column > component must always be a child of an < apex:dataTable > or < apex:pageBlockTable > component.

This tag supports following attributes:
Attribute
Description
breakBefore
A Boolean value that specifies whether the column should begin a new row in the table. If set to true, the column begins a new row. If not specified, this value defaults to false.
colspan
The number of columns that this column spans in the table. Note that this value does not apply to the header and footer cells.
dir
The direction in which text in the generated column should be read. Possible values include "RTL" (right to left) or "LTR" (left to right). Note that this value does not apply to the header and footer cells.
footerClass
The style class used to display the column footer, if defined. This attribute is used primarily to designate which CSS styles are applied when using an external CSS stylesheet.
footercolspan
This attribute was deprecated in Salesforce API version 16.0 and has no effect on the page.
footerdir
This attribute was deprecated in Salesforce API version 16.0 and has no effect on the page.
footerlang
This attribute was deprecated in Salesforce API version 16.0 and has no effect on the page.
footeronclick
This attribute was deprecated in Salesforce API version 16.0 and has no effect on the page.
footerondblclick
This attribute was deprecated in Salesforce API version 16.0 and has no effect on the page.
footeronkeydown
This attribute was deprecated in Salesforce API version 16.0 and has no effect on the page.
footeronkeypress
This attribute was deprecated in Salesforce API version 16.0 and has no effect on the page.
footeronkeyup
This attribute was deprecated in Salesforce API version 16.0 and has no effect on the page.
footeronmousedown
This attribute was deprecated in Salesforce API version 16.0 and has no effect on the page.
footeronmousemove
This attribute was deprecated in Salesforce API version 16.0 and has no effect on the page.
footeronmouseout
This attribute was deprecated in Salesforce API version 16.0 and has no effect on the page.
footeronmouseover
This attribute was deprecated in Salesforce API version 16.0 and has no effect on the page.
footeronmouseup
This attribute was deprecated in Salesforce API version 16.0 and has no effect on the page.
footerstyle
This attribute was deprecated in Salesforce API version 16.0 and has no effect on the page.
footertitle
This attribute was deprecated in Salesforce API version 16.0 and has no effect on the page.
footerValue
The text that should be displayed in the column footer. If you specify a value for this attribute, you cannot use the column's footer facet.
headerClass
The style class used to display the table header, if defined. This attribute is used primarily to designate which CSS styles are applied when using an external CSS stylesheet.
headercolspan
The number of columns that the header column spans in the table, if defined. This attribute cannot be used in Visualforce page versions 16.0 and above.
headerdir
This attribute was deprecated in Salesforce API version 16.0 and has no effect on the page.
headerlang
This attribute was deprecated in Salesforce API version 16.0 and has no effect on the page.
headeronclick
This attribute was deprecated in Salesforce API version 16.0 and has no effect on the page.
headerondblclick
This attribute was deprecated in Salesforce API version 16.0 and has no effect on the page.
headeronkeydown
This attribute was deprecated in Salesforce API version 16.0 and has no effect on the page.
headeronkeypress
This attribute was deprecated in Salesforce API version 16.0 and has no effect on the page.
headeronkeyup
This attribute was deprecated in Salesforce API version 16.0 and has no effect on the page.
headeronmousedown
This attribute was deprecated in Salesforce API version 16.0 and has no effect on the page.
headeronmousemove
This attribute was deprecated in Salesforce API version 16.0 and has no effect on the page.
headeronmouseout
This attribute was deprecated in Salesforce API version 16.0 and has no effect on the page.
headeronmouseover
This attribute was deprecated in Salesforce API version 16.0 and has no effect on the page.
headeronmouseup
This attribute was deprecated in Salesforce API version 16.0 and has no effect on the page.
headerstyle
This attribute was deprecated in Salesforce API version 16.0 and has no effect on the page.
headertitle
This attribute was deprecated in Salesforce API version 16.0 and has no effect on the page.
headerValue
The text that should be displayed in the column header. If you specify a value for this attribute, you cannot use the column's header facet. Note also that specifying a value for this attribute overrides the default header label that appears if you use an inputField or outputField in the column body.
id
An identifier that allows the column component to be referenced by other components in the page.
lang
The base language for the generated HTML output, for example, "en" or "en-US".
onclick
The JavaScript invoked if the onclick event occurs in the column --that is, if the column is clicked. Note that this value does not apply to the header and footer cells.
ondblclick
The JavaScript invoked if the ondblclick event occurs in the column that is, if the column is clicked twice. Note that this value does not apply to the header and footer cells.
onkeydown
The JavaScript invoked if the onkeydown event occurs in the column  that is, if the user presses a keyboard key. Note that this value does not apply to the header and footer cells.
onkeypress
The JavaScript invoked if the onkeypress event occurs in the column that is, if the user presses or holds down a keyboard key. Note that this value does not apply to the header and footer cells.
onkeyup
The JavaScript invoked if the onkeyup event occurs in the column that is, if the user releases a keyboard key. Note that this value does not apply to the header and footer cells.
onmousedown
The JavaScript invoked if the onmousedown event occurs in the column that is, if the user clicks a mouse button. Note that this value does not apply to the header and footer cells.
onmousemove
The JavaScript invoked if the onmousemove event occurs in the column that is, if the user moves the mouse pointer. Note that this value does not apply to the header and footer cells.
onmouseout
The JavaScript invoked if the onmouseout event occurs in the column that is, if the user moves the mouse pointer away from the column. Note that this value does not apply to the header and footer cells.
onmouseover
The JavaScript invoked if the onmouseover event occurs in the column that is, if the user moves the mouse pointer over the column. Note that this value does not apply to the header and footer cells.
onmouseup
The JavaScript invoked if the onmouseup event occurs in the column that is, if the user releases the mouse button. Note that this value does not apply to the header and footer cells.
rendered
A Boolean value that specifies whether the component is rendered on the page. If not specified, this value defaults to true.
rowspan
The number of rows that each cell of this column takes up in the table.
style
The style used to display the column, used primarily for adding inline CSS styles. Note that this value does not apply to the header and footer cells.
styleClass
The style class used to display the column, used primarily to designate which CSS styles are applied when using an external CSS stylesheet. Note that this value does not apply to the header and footer cells.
title
The text to display as a tooltip when the user's mouse pointer hovers over this component.
value
The text that should be displayed in every cell of the column, other than its header and footer cells. If you specify a value for this attribute, you cannot add any content between the column's opening and closing tags.
width
The width of the column in pixels (px) or percentage (%). If not specified, this value defaults to 100 pixels.

Visualforce Example:


<apex:page standardController="Lead" recordSetVar="Leads">
  <apex:pageBlock title="Columns">
         <apex:pageBlockTable value="{!Leads}" var="le">
             <apex:column value="{!le.name}"/> 
             <apex:column value="{!le.Phone}"/>
             <apex:column value="{!le.Company}"/>
             <apex:column value="{!le.Status}"/>
             <apex:column value="{!le.Email}"/>
         </apex:pageBlockTable> 
     </apex:pageBlock> 
</apex:page>


save image




0 comments:

Post a Comment

 
| ,