+ Start a Discussion

Freeze the pageblock table (with scroll bar) header.


I have a pageblock table on a Vf page with a scrollbar.


please anybody can help me to fix the header.


I know it is possible through java script. So if anybody  can share the javescript with me?




Try the below code snippet as reference:

<apex:page standardController="Opportunity" recordSetVar="opportunities">

  <apex:form >

    <apex:pageBlock >

      <apex:pageMessages />

      <apex:pageBlockButtons >

        <apex:commandButton value="Save" action="{!save}"/>


      <apex:outputpanel style="overflow:scroll;height:250px;" layout="block">

      <apex:pageBlockTable value="{!opportunities}" var="opp">

        <apex:column value="{!opp.name}"/>

        <apex:column headerValue="Stage">

          <apex:inputField value="{!opp.stageName}"/>


        <apex:column headerValue="Close Date">

          <apex:inputField value="{!opp.closeDate}"/>








Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 



Hi ,do u need to mention the below style.


<apex:outputpanel style="overflow:scroll;height:250px;" layout="block">


Thanks for your reply. But already i have tried this . This is only to put a scroll bar , not to freeze the header.  I know that it is possible using a j query. but i donot have any idea about jquery.




     U need to use this to achieve scollable header:


      I implemented in VF pages and works great.


Thanks & Regards,

Vivek V.