+ Start a Discussion
David Torres 30David Torres 30 

Set height of LWC lightning-datatable up to remaining screen height

It is known that for enabling infinite loading it is necessary to wrap the data table in a parent element and define a height, ex:
 
<div style='height:300px'>
<lightning-datatable key-field="id"  data={data}  columns={columns}> </lightning-datatable> 
</div>
but, what if I am rendering the lwc in full screen? I want to emulate the behaviour of a list view where the table fits perfectly in the screen height without having two scrolls, is that possible? I have tried several styles and it does not seem easy to achieve it without modifying the content inside the data table. hope you can help.
Danish HodaDanish Hoda
Hi David,
Please try <div style='height:100%'>
David Torres 30David Torres 30
Hi Danish,

Thanks for the response, unfortunately, it does not work.