{"id":2137,"date":"2016-11-04T11:19:25","date_gmt":"2016-11-04T11:19:25","guid":{"rendered":"http:\/\/www.greytrix.com\/blogs\/salesforce\/?p=2137"},"modified":"2025-06-10T10:29:32","modified_gmt":"2025-06-10T10:29:32","slug":"apply-fixed-headers-in-visual-force-page-for-large-records","status":"publish","type":"post","link":"https:\/\/www.greytrix.com\/blogs\/salesforce\/2016\/11\/04\/apply-fixed-headers-in-visual-force-page-for-large-records\/","title":{"rendered":"Apply fixed headers in Visual Force Page for Large Records"},"content":{"rendered":"<p>Visualforce page can display a maximum of 1000 records and let us tell you this is not a small number. When all the 1000 records show up on your page, you have to keep scrolling down to see the records appearing at the bottom of your table. Though, by the time you reach the bottom records you have no track of the column headers they correspond to. It just appears to be some blob of data and could be really confusing for the one who is looking at them. Won\u2019t it be good if you have the headers of the table fixed and no matter how much you scroll down or up, they are always there for you.<\/p>\n<p>There are various work arounds to achieve the fixed headers for table. But the method we are going to discuss is easy as compared to others. First download the zip file for \u201cjqueryfixedheadertable\u201d. Extract it and upload it in static resources of your Salesforce org with the same name. Now, include this script in your VisualForce page.<\/p>\n<div id=\"attachment_2138\" style=\"width: 683px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2016\/11\/1.-Including-static-resource-file-in-your-code.png\" target=\"_blank\" rel=\"noopener\"><img fetchpriority=\"high\" decoding=\"async\" aria-describedby=\"caption-attachment-2138\" class=\"size-full wp-image-2138\" src=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2016\/11\/1.-Including-static-resource-file-in-your-code.png\" alt=\"Including static resource file in your code\" width=\"673\" height=\"77\" \/><\/a><p id=\"caption-attachment-2138\" class=\"wp-caption-text\">Including static resource file in your code<\/p><\/div>\n<p>Now, under script tag in VisualForce page write the following code.<\/p>\n<div id=\"attachment_2139\" style=\"width: 730px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2016\/11\/2.-JScript-function-for-fixed-haeders.png\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" aria-describedby=\"caption-attachment-2139\" class=\"size-full wp-image-2139\" src=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2016\/11\/2.-JScript-function-for-fixed-haeders.png\" alt=\"JScript function for fixed haeders\" width=\"720\" height=\"229\" \/><\/a><p id=\"caption-attachment-2139\" class=\"wp-caption-text\">JScript function for fixed haeders<\/p><\/div>\n<p>Based on how you are going to populate the table, be it on commandbutton&#8217;s click or through other means, call the \u201cApplyFixHeaders\u201d function on its onclick or oncomplete as per your requirement. Now, for your pageblock table add a property styleclass and its value as \u201cfixheaders\u201d.<\/p>\n<div id=\"attachment_2140\" style=\"width: 950px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2016\/11\/3.-Applying-styleclass-to-table.png\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" aria-describedby=\"caption-attachment-2140\" class=\"size-full wp-image-2140\" src=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2016\/11\/3.-Applying-styleclass-to-table.png\" alt=\"Applying styleclass to table\" width=\"940\" height=\"53\" \/><\/a><p id=\"caption-attachment-2140\" class=\"wp-caption-text\">Applying styleclass to table<\/p><\/div>\n<p>Once, you have completed all the above mentioned steps, you can go ahead and test the functionality. In addition to this, if you are dealing with large records you can easily implement a navigation bar at the bottom of the table which would be helpful in navigating the records.<\/p>\n<div id=\"attachment_2141\" style=\"width: 605px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2016\/11\/4.-Fixed-header-table.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2141\" class=\"size-large wp-image-2141\" src=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2016\/11\/4.-Fixed-header-table-1024x235.jpg\" alt=\"Fixed header table\" width=\"595\" height=\"137\" \/><\/a><p id=\"caption-attachment-2141\" class=\"wp-caption-text\">Fixed header table<\/p><\/div>\n<p>If you wish to acquire more details on how to customize the columns, their width, how to keep the first column fixed and so on, visit this link Scrollable fixed header table jquery plugin. If you want further source related information to the fixed headers please visit this link- TableFixedHeader.<\/p>\n<p><span style=\"font-size: Medium;\"><strong>About Us<\/strong><\/span><br \/>\n<a href=\"https:\/\/www.greytrix.com\/\">Greytrix<\/a>\u00a0as a Salesforce Product development partner offers a wide variety of integration products and services to the end users as well as to the Partners across the globe. We offers Consultation, Configuration, Training and support services in out-of-the-box functionality as well as customizations to incorporate custom business rules and functionalities that requires apex code incorporation into the Salesforce platform.<\/p>\n<p><a href=\"https:\/\/www.greytrix.com\/\">Greytrix<\/a>\u00a0has some unique solutions for Cloud CRM such as Salesforce integration with\u00a0<a href=\"https:\/\/www.greytrix.com\/product\/sage-x3\/gumu-x3-salesforce-integration\">Sage Enterprise Management (Sage X3<\/a>),\u00a0Sage Intacct, <a href=\"https:\/\/www.greytrix.com\/product\/sage-100-erp\/gumu-100-salesforce-integration\">Sage 100\u00a0<\/a>and\u00a0<a href=\"https:\/\/www.greytrix.com\/product\/sage-300-erp\/gumu-300-salesforce-integration\">Sage 300 (Sage Accpac)<\/a>. We also offer best-in-class Cloud CRM\u00a0<a href=\"https:\/\/www.greytrix.com\/product\/crm-development\/salesforce-com\">Salesforce customization and development services<\/a> along with services such as Salesforce <a href=\"https:\/\/www.greytrix.com\/product\/professional-services\/data-migration-services\">Data Migration<\/a>, <a href=\"https:\/\/www.greytrix.com\/product\/professional-services\/integrated-application-development\">Integrated App development<\/a>, <a href=\"https:\/\/www.greytrix.com\/product\/professional-services\/custom-development\">Custom App development<\/a> and <a href=\"https:\/\/www.greytrix.com\/product\/professional-services\/maintenance-support\">Technical Support<\/a> to business partners and end users.<\/p>\n<p>Greytrix GUMU&#x2122; integration for Sage ERP \u2013 Salesforce is a 5-star app listed on <a href=\"https:\/\/appexchange.salesforce.com\/listingDetail?listingId=a0N30000000psM5EAI\" target=\"_blank\" rel=\"noopener\">Salesforce AppExchange<\/a>.<\/p>\n<p>For more information, please contact us at\u00a0<a href=\"mailto:salesforce@greytrix.com\">salesforce@greytrix.com<\/a>. We will be glad to assist you.<\/p>\n<p><strong><span style=\"font-size: Medium;\">Related Posts<\/span><\/strong><\/p>\n<ul>\n<li><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2016\/09\/20\/real-time-details-in-gumu-sage-x3-integration-for-salesforce\/\" target=\"_blank\" rel=\"noopener\">Real-time details in GUMU SAGE X3 Integration for Salesforce<\/a><\/li>\n<li><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2016\/09\/07\/deployment-options-for-changeset\/\" target=\"_blank\" rel=\"noopener\">Deployment Options for Changeset<\/a><\/li>\n<li><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2016\/08\/30\/save-records-via-lightning-app\/\" target=\"_blank\" rel=\"noopener\">Save Records via Lightning App<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Visualforce page can display a maximum of 1000 records and let us tell you this is not a small number. When all the 1000 records show up on your page, you have to keep scrolling down to see the records appearing at the bottom of your table. Though, by the time you reach the bottom\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2016\/11\/04\/apply-fixed-headers-in-visual-force-page-for-large-records\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[132,195,254,367,522],"class_list":["post-2137","post","type-post","status-publish","format-standard","hentry","category-salesforce-srv","tag-fixed-headers","tag-jquery","tag-pageblock-table","tag-salesforce","tag-visualforce"],"_links":{"self":[{"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts\/2137","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/comments?post=2137"}],"version-history":[{"count":2,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts\/2137\/revisions"}],"predecessor-version":[{"id":10886,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts\/2137\/revisions\/10886"}],"wp:attachment":[{"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/media?parent=2137"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/categories?post=2137"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/tags?post=2137"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}