Problem
lightning:datatable (rendered as a lightning-datatable) places itself in a wrapper that is only exactly as big as it needs to be. If you click on a header-level action in a table with no rows, the table scrolls up, hiding the header row almost completely. If you click on an area within the lightning:datatable, it usually scrolls back down so you can see the header row, but clicking anywhere else results in an essentially blank area where the menus can no longer be seen.
SSCCE
<aura:application extends="force:slds">
<aura:attribute name="columns" type="List" default="[ { label: 'Other' }, { label: 'Demo', type: 'action', actions: [ { label: 'Demo', name: 'demo' } ] } ]" />
<aura:attribute name="data" type="List" default="[ ]" />
<lightning:datatable columns="{!v.columns}" data="{!v.data}" keyField="Id" />
</aura:application>
Attempts
I tried adding various types of CSS, including a wrapper element, applying a style directly to the table, etc, but nothing seems to work.
Example Attempts
.THIS.dataTable {
min-height: 3em;
}
<lightning:datatable class="dataTable" columns="{!v.columns}" data="{!v.data}" keyField="Id" />
<div class="dataTable">
<lightning:datatable columns="{!v.columns}" data="{!v.data}" keyField="Id" />
</div>
Since we can't really "reach" into the component any more because of how LWC works with CSS, is there a solution to this problem other than rendering dummy rows?
lightning:datatable
Lightning Aura Component and notlightning-datatable
LWC?lightning:datatable
may render aslightning-datatable
at the platform level, but I think it will be still good to have the terminologies separated and respective to the frameworks for a larger audience so that majority don't mix up (as I did)