Add Scrollbar below header

Hi,

Is it possible to add a scrollbar below the header? not only the bottom of the table.


Regards,

Kuan Long


3 Replies

RS Rajapandiyan Settu Syncfusion Team May 5, 2022 11:44 AM UTC

Hi Kuan,


Thanks for contacting Syncfusion support.


Based on your requirement, you want to show the scrollbar on both top and bottom of the Grid. You can achieve your requirement by using the following code in the created event of Grid.


Created: https://ej2.syncfusion.com/javascript/documentation/api/grid/#created


 

<style>

   .top_scroller {

      overflow-x: scroll;

      overflow-y: hidden;

      margin: 0 16px 0 0;

   }

   .top_scroller_content {

      height: 0.1px;

   }

</style>

 

<script>

    function created(args) {

        // render another div element above the grid content element with respect to the grid width

        var scrollerdiv = document.createElement('div');

        scrollerdiv.classList.add('top_scroller');

        scrollerdiv.width = this.width;

 

        var contentdiv = document.createElement('div');

        contentdiv.classList.add('top_scroller_content');

        contentdiv.style.width = this.element.querySelector('.e-gridcontent table').offsetWidth + 'px';

 

        scrollerdiv.appendChild(contentdiv);

        this.element.insertBefore( scrollerdiv, this.element.querySelector('.e-gridcontent'));

 

        var gridscroller = document.querySelector('.e-gridcontent .e-content');

 

        // dynamically scroll the both div (custom div and grid content)

        scrollerdiv.onscroll = function () {

            gridscroller.scrollLeft = scrollerdiv.scrollLeft;

        }

        gridscroller.onscroll = function () {

            scrollerdiv.scrollLeft = gridscroller.scrollLeft;

        }

    }

</script>

 


Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/core_grid_scroller_top_bottom253444224.zip


Please let us know if you have any concerns.


Regards,

Rajapandiyan S



KL Kuan Long Khiu May 31, 2022 07:48 AM UTC

Thanks for replying.



SS Swetha Srikumar Syncfusion Team June 1, 2022 07:39 AM UTC

Most Welcome. 


Loader.
Up arrow icon