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
ChrisYazChrisYaz 

Reset scroll bar on a lightning:datatable?

I implemented a component with a lightning datatable. There will be a large list of records so I have also included pagination. All of this is working fine except for the scroll bar. When I do a "component.set" on the lightning:datatable the new list of records is refreshed however the scroll bar remains at the bottom or wherever the user last left off.

Is there a way to scroll the bar to the top automatically or set focus on the first row in the new list?
AbhishekAbhishek (Salesforce Developers) 
Hi Chris,


Please refer to the below links which might help you further with the above requirement.

https://developer.salesforce.com/forums/?id=906F0000000AeE2IAK

https://salesforce.stackexchange.com/questions/78514/scroll-to-top-in-a-lightning-component

https://salesforce.stackexchange.com/questions/197200/scroll-page-to-top-onclick-of-a-button-in-saleforce1

https://developer.salesforce.com/forums/?id=9060G0000005YtaQAE

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Thanks.
ChrisYazChrisYaz
Hi @Abhlshek - The ask isn't to scroll to the top of the page, the ask is to scroll to the top of a data table.
sonu kumar 74sonu kumar 74
great but how to implement scrolling will do it? love failure images (https://www.imagesdownloadhd.com/love-failure-images/)
AbhishekAbhishek (Salesforce Developers) 
Try this chris,

http://salesforce.stackexchange.com/questions/78514/scroll-to-top-in-a-lightning-component

https://developer.salesforce.com/forums/?id=9060G000000Xc2uQAC
ChrisYazChrisYaz
Hi @Abhlshek - I appreciate the help but the scroller wrapper will just scroll the entire table header included adding a second scroll bar if the table dips between the defined window. On lightning:datatable there is a separate scroll bar included for just the rows. I need to be able to move that to the top or set focus to the top row.