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
Amrita Panda 2Amrita Panda 2 

How to use browser scrollbar to scroll the table data?

I have created a lighting component in which there is a table..Now i am having 2 scrollbars(one for the browser and another for the table data)..How to merge both the scrollbars into one(i.e, the browser scrollbar)... 
NagendraNagendra (Salesforce Developers) 
Hi Amrita,

Please find the sample code below which should help you in achieving the above requirement.
({
        afterRender : function( component, helper ) {
            this.superAfterRender();
            var didScrolled;
            var div = component.find('scroll_container');
            if(!$A.util.isEmpty(div)){
                div = div.getElement();
                div.onscroll = function(){
                    didScrolled = true;
                    };
                //Interval function to check if the user scrolled or if there is a scrollbar
                var intervalId = setInterval($A.getCallback(function(){
                    if(didScrolled){
                        didScrolled = false;
                        if(div.scrollTop === (div.scrollHeight - div.offsetHeight)){
                            helper.getNextPage(component);
                        }
                    }
                }), 750);
                component.set('v.intervalId', intervalId);
            }
        },
        unrender: function( component) {
            this.superUnrender();
            var intervalId = component.get( 'v.intervalId' );
            if ( !$A.util.isUndefinedOrNull( intervalId ) ) {
                window.clearInterval( intervalId );
            }
        }
    })
For more information please refer to below link. Kindly mark this as solved if the reply was helpful so that it gets removed from the unanswered queue which results in helping others who are facing a similar issue.

Thanks,
Nagendra