rintoj / ngx-virtual-scroller

Virtual Scroll displays a virtual, "infinite" list.
https://rintoj.github.io/ngx-virtual-scroller
MIT License
978 stars 294 forks source link

Scrollbar height calculation when there are few items in the table #310

Open masha1337 opened 5 years ago

masha1337 commented 5 years ago

In our use case we have a table in the scroll.viewPortItems and there are cases, when the table is shorter than the actual screen height. When the page is loaded, the scrollbar appears and after the content height is calculated, it disappears. It's causing the page to flicker. Is there a way to prevent it from appearing?

<div class="timeline-container" #timeline (scroll)="onScroll($event)">
  <virtual-scroller #scroll [items]="tableTypes" (vsUpdate)="rf.detectChanges()" [parentScroll]="timeline">
    <table>
      <thead #header>
      <tr>
        <th>name</th>
        <th>REFERENCE VALUE</th>
        <th>Units</th>
      </tr>
      </thead>
      <tbody #container>
      <tr *ngFor="let item of scroll.viewPortItems">
        <td></td>
      </tr>
      </tbody>
    </table>
  </virtual-scroller>
</div>
speige commented 5 years ago

Please convert this to a StackBlitz