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 restrict scrollbar to be for a table and not in the browser(lightning component)?

Raj VakatiRaj Vakati
Can you explain more, please  .. you  mean you want scroll around the table?
Amrita Panda 2Amrita Panda 2
Hi Raj, I am new to lightning component..I have created a table with fixed headers...I want the scrollbar to scrll down the rows in the table keeping the headers fixed....but now i am having a scrollbar in my browser ..So my question is how to remove that scrollbar which is in the browser and instead of that add a scrollbar only for the table ?
Lokesh Krishna SagiLokesh Krishna Sagi
Hello Amrita,

Include your lightning:dataTable component within a dev tag with height style like below

<div style="height: 500px">
      // <your dataTable component>

change the height to the required px.

Please mark this as Best answer if this what you are looking for or let us know if any other info needed. 

If you dont want to use other HTML tags and just want to use the native lightning components, you can make use of infinite scrolling of lightning dataTable. Let me know if you need help on that. 

Amrita Panda 2Amrita Panda 2
Hi lokesh,
I am using only <table> tag and not data table...And the height is not making any difference.