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
Mikko4Mikko4 

Fixed height for pageBlock

Hello,

 

Is it possible to have fixed pre-defined height for a pageBlock? I would like to add a Visualforce page to Home Page. Ideally the pageBlock element would always have same height and since the content of it is a table which can have 0-n rows the scrollbar would appear inside the pageBlock.

 

Thanks!

prageethprageeth

You can wrap the pageblock inside an outputPanel and give that output panel a fixed height. See following example.

 

<apex:page standardController="Opportunity">
<style>
    .container{
        overflow:auto;
        height:100px;
    }
</style>
<apex:outputPanel layout="block" styleclass="container">
  <apex:pageblock>
    <apex:pageblocktable value="{!Opportunity.opportunityLineItems}" var="v">
        <apex:column value="{!v.unitPrice}"/>
    </apex:pageblocktable>
  </apex:pageblock>
</apex:outputPanel>
</apex:page>

 

TehNrdTehNrd

Almost, but   wants the scroll bars to be inside of the pageblock.

 

 

<apex:page standardController="Opportunity">
	<style>
		.container{
			overflow:auto;
			height:100px;
		}
	</style>

	<apex:pageblock>
		<apex:outputPanel layout="block" styleclass="container">
			<apex:pageblocktable value="{!Opportunity.opportunityLineItems}" var="v">
				<apex:column value="{!v.unitPrice}"/>
			</apex:pageblocktable>
		</apex:outputPanel>
	</apex:pageblock>
	
</apex:page>

 

 

Geoffry BillingGeoffry Billing
@TehNrd Super big nercro thanks for this. I've searched everywhere for how to add some V scroll bars. Was working through a massivly complicated pagination as a last resort but found your post at the last minute and it worked for me.

Thanks - 7 years on!