Supporting files  1. Base css -  https://raw.githubusercontent.com/benjaminleouzon/tablefixedheader/master/css/base.css 2. Theme css -  https://raw.githubusercontent.com/benjaminleouzon/tablefixedheader/master/jquery-ui/css/flick/jquery-ui-1.8.4.custom.css 3. FixedHeader Js -  https://raw.githubusercontent.com/benjaminleouzon/tablefixedheader/master/javascript/jquery.fixheadertable.js", "upvoteCount": 0, "url": "https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007T4WhOSAV", "datePublished": "2015-08-24T10:15:01.000Z", "author": { "@type": "Person", "name": "Karanraj Sankaranarayanan", "url": "https://trailblazers.salesforce.com/profileView?u=00530000004fXkCAAU", "affiliation": { "@type": "Organization", "name": "Auraforce Technologies Inc" } } }, "suggestedAnswer": [ { "@type": "Answer", "text": "The above code helped us to get the fixed columns but we are facing different issues . Here the column headers are fixed and it is not varying based on content . Could anybody resolved this issue .please help me", "upvoteCount": 0, "url": "https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007T4WhOSAV", "datePublished": "2016-06-14T14:47:16.000Z", "author": { "@type": "Person", "name": "divya gorantla", "url": "https://trailblazers.salesforce.com/profileView?u=0053000000Bed5gAAB", "affiliation": { "@type": "Organization", "name": "Infosys" } } } ] } } Skip to main content
Hi all,

I have loaded account details in visualforce page through pageblock table, if data exceeds the page it has to show scroll down, if i scroll down the column headers should not be scroll down.

Bellow is my code. and what lines i need to add for bellow code.

---------------

<apex:page standardController="Account" recordSetVar="rcst">

    <apex:form >

        <apex:pageBlock title="Accounts" >

            <div style="overflow: auto; height: 200px;" layout="block" position ="fixed">

                <apex:pageblockTable value="{!rcst}" var="a" headerClass="headerStyle" width="100%">

                    <apex:column value="{!a.Id}" ></apex:column>

                    <apex:column value="{!a.Name}" ></apex:column>

                    <apex:column value="{!a.type}" ></apex:column>

                    <apex:column value="{!a.industry}"></apex:column>

                <apex:inlineEditSupport />

                </apex:pageblockTable>

            </div>                                        

        </apex:pageBlock>

    </apex:form>

</apex:page>

Thanks.
5 个回答
  1. 2015年8月24日 10:15

    Venky - Using jquery fixed header table plugin you can able to do that, check the below sample code for the sample

    <apex:page standardController="Account" standardStylesheets="false">

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>

    <script src="{!$Resource.jqueryfixheadertable}"></script>

    <apex:stylesheet value="{!$Resource.base}" />

    <apex:stylesheet value="{!$Resource.themefile}" />

    <apex:form id="theform">

    <script>

    $(document).ready(function() {

    $('.fixme').fixheadertable({

    caption : 'My header is fixed !',

    height : 200

    });

    });

    </script>

    <apex:pageBlock title="My Content" >

    <apex:pageBlockTable value="{!account.Contacts}" var="item" styleclass="fixme">

    <apex:column headerValue="Col1" value="{!item.name}"/>

    <apex:column headerValue="Col2" value="{!item.name}"/>

    <apex:column headerValue="Col2" value="{!item.name}"/>

    <apex:column headerValue="Col2" value="{!item.name}"/>

    </apex:pageBlockTable>

    </apex:pageBlock> </apex:form>

    </apex:page>

    Supporting files 

    1. Base css - https://raw.githubusercontent.com/benjaminleouzon/tablefixedheader/master/css/base.css

    2. Theme css - https://raw.githubusercontent.com/benjaminleouzon/tablefixedheader/master/jquery-ui/css/flick/jquery-ui-1.8.4.custom.css

    3. FixedHeader Js - https://raw.githubusercontent.com/benjaminleouzon/tablefixedheader/master/javascript/jquery.fixheadertable.js