function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
hacksawblade16hacksawblade16 

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"/>
        </apex:pageBlockTable> 
    </apex:pageBlock> 
</apex:page>