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
Yogesh LolgeYogesh Lolge 

Can we make pageblock table as fit to page

Hi, I am Yogesh Lolge, I want to make page block table as fit to page as when I am using 9 columns in the table it's going out of the margin of a page, is it possible
AbhishekAbhishek (Salesforce Developers) 
Yogesh,

You have to write custom code for the above requirement.

https://developer.salesforce.com/forums/?id=9060G0000005MmIQAU
https://salesforce.stackexchange.com/questions/218763/controlling-pageblocktable-table-width
https://developer.salesforce.com/forums/?id=906F000000096a7IAA
https://stackoverflow.com/questions/17389859/how-to-make-apexpageblocktable-size-to-full-screen-size/17390688

Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Thanks.
Malika Pathak 9Malika Pathak 9

Hi Yogesh,

please find the solution.

You can use the below code on your org.

Add to pageBlockSection columns="1"


eg:- <apex:pageBlockSection title="Different Columns" columns="1">

 

<apex:page standardController="Account" recordSetVar="Accounts" >
    <apex:pageBlock>
    	<apex:pageBlockSection title="Different Columns" columns="1">
         <apex:pageBlockTable value="{! Accounts}" var="a">
                <apex:column headerValue="Action" />
                <apex:column headerValue="Action" />
                <apex:column headerValue="Action" />
                <apex:column headerValue="Action" />
                <apex:column headerValue="Action" />
                <apex:column headerValue="Action" />
                <apex:column headerValue="Action" />
                <apex:column headerValue="Action" />                          			
                <apex:column headerValue="Account Name" />
                <apex:column value="{!a.Name}" />
            </apex:pageBlockTable>
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:page>
 

 

if you find this helpful mark it as the best answer.