anusha(salesforce developer)

Friday, 29 July 2016

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

<apex:pageBlockSectionItem>:
A single piece of data in an < apex:pageBlockSection > that takes up one column in one row. An < apex:pageBlockSectionItem > component can include up to two child components. If no content is specified, the column is rendered as an empty space. If one child component is specified, the content spans both cells of the column. If two child components are specified, the content of the first is rendered in the left, "label" cell of the column, while the content of the second is rendered in the right, "data" cell of the column.

This tag supports following attributes:

Attribute
Description
dataStyle
The CSS style used to display the content of the right, "data" cell of the pageBlockSection column.
dataStyleClass
The CSS style class used to display the content of the right, "data" cell of the pageBlockSection column.
dataTitle
The text displayed when you hover over the right, "data" cell of the pageBlockSection column.
dir
The direction in which the generated HTML component is read. Possible values include "RTL" (right to left) or "LTR" (left to right).
helpText
The help text that is displayed next to this field as a hover-based tooltip, similar to the text that is displayed next to standard Salesforce fields if custom help is defined for the field in Setup. Note that help text only displays if the showHeader attribute of the parent page is set to true.
id
An identifier that allows the pageBlockSectionItem component to be referenced by other components in the page.
labelStyle
The CSS style used to display the content of the left, "label" cell of the pageBlockSection column.
labelStyleClass
The CSS style class used to display the content of the left, "label" cell of the pageBlockSection column.
labelTitle
The text displayed when you hover over the left, "label" cell of the pageBlockSection column.
lang
The base language for the generated HTML output, for example, "en" or "en-US".
onDataclick
The JavaScript invoked if the onDataclick event occurs that is, if the user clicks the right, "data" cell of the pageBlockSection column.
onDatadblclick
The JavaScript invoked if the onDatadblclick event occurs that is, if the user clicks the right, "data" cell of the pageBlockSection column twice.
onDatakeydown
The JavaScript invoked if the onDatakeydown event occurs that is, if the user presses a keyboard key.
onDatakeypress
The JavaScript invoked if the onDatakeypress event occurs that is, if the user presses or holds down a keyboard key.
onDatakeyup
The JavaScript invoked if the onDatakeyup event occurs that is, if the user releases a keyboard key.
onDatamousedown
The JavaScript invoked if the onDatamousedown event occurs that is, if the user clicks a mouse button.
onDatamousemove
The JavaScript invoked if the onDatamousemove event occurs that is, if the user moves the mouse pointer.
onDatamouseout
The JavaScript invoked if the onDatamouseout event occurs hat is, if the user moves the mouse pointer away from the right, "data" cell of the pageBlockSection column.
onDatamouseover
The JavaScript invoked if the onDatamouseover event occurs that is, if the user moves the mouse pointer over the right, "data" cell of the pageBlockSection column.
onDatamouseup
The JavaScript invoked if the onDatamouseup event occurs that is, if the user releases the mouse button.
onLabelclick
The JavaScript invoked if the onLabelclick event occurs that is, if the user clicks the left, "label" cell of the pageBlockSection column.
onLabeldblclick
The JavaScript invoked if the onLabeldblclick event occurs that is, if the user clicks the left, "label" cell of the pageBlockSection column twice.
onLabelkeydown
The JavaScript invoked if the onLabelkeydown event occurs that is, if the user presses a keyboard key.
onLabelkeypress
The JavaScript invoked if the onLabelkeypress event occurs that is, if the user presses or holds down a keyboard key.
onLabelkeyup
The JavaScript invoked if the onLabelkeyup event occurs that is, if the user releases a keyboard key.
onLabelmousedown
The JavaScript invoked if the onLabelmousedown event occurs that is, if the user clicks a mouse button.
onLabelmousemove
The JavaScript invoked if the onLabelmousemove event occurs that is, if the user moves the mouse pointer.
onLabelmouseout
The JavaScript invoked if the onLabelmouseout event occurs that is, if the user moves the mouse pointer away from the left, "label" cell of the pageBlockSection column.
onLabelmouseover
The JavaScript invoked if the onLabelmouseover event occurs that is, if the user moves the mouse pointer over the left, "label" cell of the pageBlockSection column.
onLabelmouseup
The JavaScript invoked if the onLabelmouseup event occurs that is, if the user releases the mouse button.
rendered
A Boolean value that specifies whether the component is rendered on the page. If not specified, this value defaults to true.

Visualforce Example:


<apex:page standardController="Account">
  <apex:form >
    <apex:pageBlock title="My Content" mode="edit">
       <apex:pageBlockButtons >
         <apex:commandButton action="{!save}" value="Save"/>
       </apex:pageBlockButtons>
  
        <apex:pageBlockSection title="My Content Section"      columns="2">
          <apex:pageBlockSectionItem >
          <apex:outputLabel value="Account Name"  for="account__name"/> 
          <apex:inputText value="{!account.name}" id="account__name"/> 
          </apex:pageBlockSectionItem>

          <apex:pageBlockSectionItem >
          <apex:outputLabel value="Account Site" for="account__site"/>
          <apex:inputText value="{!account.site}" id="account__site"/>
          </apex:pageBlockSectionItem>

          <apex:pageBlockSectionItem >
          <apex:outputLabel value="Account Type" for="account__type"/>
          <apex:inputText value="{!account.type}" id="account__type"/>
           </apex:pageBlockSectionItem>

           <apex:pageBlockSectionItem >
           <apex:outputLabel value="Account Number" for="account__number"/>
           <apex:inputText value="{!account.accountNumber}" id="account__number"/> 
           </apex:pageBlockSectionItem> 
          </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>


save image



No comments:

Post a Comment