Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

236
Views
how to make cdk virtual scroll render items of the table

I'm using CDK VIRTUAL SCROLL in a table that loads a service (API) that returns me a list, with this list I can remove or return their columns respectively as well as their items, but when I remove all columns from the table and requested to return, just the columns ending up coming back normally but their items don't!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

you can to have some like

<table>
  <cdk-virtual-scroll-viewport #scroller itemSize="6" class="content">
    <ng-container *cdkVirtualFor="let item of items; let i = index">
      <thead *ngIf="!i">
        <tr>
          <td>Prop1</td>
          <td>Prop2</td>
        </tr>
      </thead>
      <tr>
        <td style="min-width:10rem">
          {{ item.prop1 }}
        </td>
        <td style="min-width:10rem">{{ item.prop1 }}</td>
      </tr>
    </ng-container>
  </cdk-virtual-scroll-viewport>
</table>

With a "typical" cdkscroll

ngOnInit()
  {
    this.fetchMore();
    this.scroller.elementScrolled().pipe(
      map(() => this.scroller.measureScrollOffset('bottom')),
      pairwise(),
      filter(([y1, y2]) => (y2 < y1 && y2 < 140)),
      throttleTime(200)
    ).subscribe(() => {
      this.ngZone.run(() => {
        this.fetchMore();
      })
    }
    );
  }
  fetchMore(): void {
    const newItems="......."
    this.items=[...this.items,...newItems]
  }

see a little stackblitz

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!