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
Janno RipJanno Rip 

Adding a name/title to apex:pageBlockTable

Hello everyone,

I'm stuck with a question regarding the naming of my pageBlockTable. I have build a custom related List using Visual Force. I am struggling however to add a title to that related List that is on the same level as my button.

This would be the default related list:

User-added image

Mine is missing the naming.

User-added image

Here is part of my VF:

 <apex:form >                 

        <apex:pageblock id="OppList" > 

          <div style="margin-left: 30%;" ><apex:commandLink value="Neue Opportunity" action="{!newOpportunity}" target="_parent" styleClass="btn" style="text-decoration:none;padding:4px;"/></div> 

            <br/> 

            <apex:pageBlockTable value="{!opportunities}" var="opp" rendered="{!NOT(ISNULL(opportunities))}" title="Contact">   

                <apex:column HeaderValue="Action" width="100" > 

                    <apex:commandLink value="Bearbeiten" style="color:#015ba7;" action="{!editOpportunity}" target="_parent" ><apex:param value="{!opp.id}" name="OpportunityId"/> 

                    </apex:commandLink> 

                    </apex:column> 
                
                <apex:column headerValue="Opportunity Name"><apex:outputLink value="/{!opp.id}" target="_blank">{!opp.Name}</apex:outputLink> </apex:column>  
                
                <apex:column value="{!opp.Inhaber_vollst_ndiger_Name__c}"/>
                
                <apex:column value="{!opp.StageName}"/> 
                
                <apex:column value="{!opp.Probability}"/>    
                
                <apex:column value="{!opp.Amount}"/>
                
                <apex:column value="{!opp.CloseDate}"/>
                       
               </apex:pageBlockTable>    

Best Answer chosen by Janno Rip
Raj VakatiRaj Vakati
Refer this links ..


You need to use custom styles and output panel 

https://salesforce.stackexchange.com/questions/24823/change-style-of-pageblock-header-standard-style

https://developer.salesforce.com/forums/?id=906F0000000DEtKIAW

http://salesforce-stuff.blogspot.com/2011/12/customise-colour-of-pageblocksection.html
https://salesforce.stackexchange.com/questions/88207/how-to-change-color-on-one-particular-pageblocksection

All Answers

Raj VakatiRaj Vakati
Change it as below

<apex:form >                 

        <apex:pageblock id="OppList" title="New Opportunity" > 

          <div style="margin-left: 30%;" ><apex:commandLink value="Neue Opportunity" action="{!newOpportunity}" target="_parent" styleClass="btn" style="text-decoration:none;padding:4px;"/></div> 

            <br/> 

            <apex:pageBlockTable value="{!opportunities}" var="opp" rendered="{!NOT(ISNULL(opportunities))}" title="Contact">   

                <apex:column HeaderValue="Action" width="100" > 

                    <apex:commandLink value="Bearbeiten" style="color:#015ba7;" action="{!editOpportunity}" target="_parent" ><apex:param value="{!opp.id}" name="OpportunityId"/> 

                    </apex:commandLink> 

                    </apex:column> 
                
                <apex:column headerValue="Opportunity Name"><apex:outputLink value="/{!opp.id}" target="_blank">{!opp.Name}</apex:outputLink> </apex:column>  
                
                <apex:column value="{!opp.Inhaber_vollst_ndiger_Name__c}"/>
                
                <apex:column value="{!opp.StageName}"/> 
                
                <apex:column value="{!opp.Probability}"/>    
                
                <apex:column value="{!opp.Amount}"/>
                
                <apex:column value="{!opp.CloseDate}"/>
                       
               </apex:pageBlockTable>    
Raj VakatiRaj Vakati
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_pageBlock.htm
Janno RipJanno Rip
Hello Raj,

thanks for the Insight. Actually I already tried that and the result is this:
User-added image

It looks like some kind of "linebreak" between the title and my button. They are not on the same level as they are in default related lists.
Raj VakatiRaj Vakati
Refer this links ..


You need to use custom styles and output panel 

https://salesforce.stackexchange.com/questions/24823/change-style-of-pageblock-header-standard-style

https://developer.salesforce.com/forums/?id=906F0000000DEtKIAW

http://salesforce-stuff.blogspot.com/2011/12/customise-colour-of-pageblocksection.html
https://salesforce.stackexchange.com/questions/88207/how-to-change-color-on-one-particular-pageblocksection
This was selected as the best answer