+ Start a Discussion

urgent :example for breakbefore attribute inside columm tag

can someone please  show an example of use of breakbefore in column tag?

Best Answer chosen by Admin (Salesforce Developers) 
Rahul SharmaRahul Sharma

BeforeBreak is very handy functionality sometimes. When we don't want to display the column as a column, rather in a next row.


Suppose we have a pageBlockTable to display UI as below.

Name                     Phone    Account Name
Test Contact 1     123          Test Account 1
Test Contact 2     1234        Test Account 1
If now we set beforeBreak = true for Account Name, Then Account column will be removed and Account Name will be displayed in the next row for each record in the table.
Output would be:
Name                                           Phone   
Test Contact 1                            123          
Test Account 1
Test Contact 2                            1234        
Test Account 1
Try this example with and without breakBefore=true:
<apex:page standardController="Account">
    <apex:pageBlock title="My Content">
        <apex:pageBlockTable value="{!account.Contacts}" var="item">
            <apex:column value="{!item.name}"/> 
            <apex:column value="{!item.phone}" />
            <apex:column value="{!item.Account.Name}"  breakBefore="true"/>