Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base example no longer works in latest Angular versions #134

Open
imbesci opened this issue Feb 1, 2025 · 0 comments
Open

Base example no longer works in latest Angular versions #134

imbesci opened this issue Feb 1, 2025 · 0 comments

Comments

@imbesci
Copy link

imbesci commented Feb 1, 2025

no content renders on the screen

Image

html

<cdk-virtual-scroll-viewport tvsItemSize>

  <table mat-table [dataSource]="dataSource">

    <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
    <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>

    <ng-container matColumnDef="id">
      <th mat-header-cell
          *matHeaderCellDef
          class="col-sm">No.</th>
      <td mat-cell
          *matCellDef="let element"
          class="col-sm">{{element.id}}</td>
    </ng-container>

    <ng-container matColumnDef="name">
      <th mat-header-cell *matHeaderCellDef>Name</th>
      <td mat-cell *matCellDef="let element">{{element.name}}</td>
    </ng-container>

  </table>

</cdk-virtual-scroll-viewport>

component.ts


import { Component } from '@angular/core';
import { TableVirtualScrollDataSource } from 'ng-table-virtual-scroll';
import {
  ScrollingModule,
  CdkVirtualScrollViewport,
} from '@angular/cdk/scrolling';
import { MatTableModule } from '@angular/material/table';

const DATA = Array.from({ length: 1000 }, (v, i) => ({
  id: i + 1,
  name: `Element #${i + 1}`,
}));

@Component({
  standalone: true,
  imports: [ScrollingModule, CdkVirtualScrollViewport, MatTableModule],
  selector: 'app-base-example',
  templateUrl: './vscroll.component.html',
  styleUrls: ['./vscroll.component.css'],
})
export class BaseExampleComponent {
  displayedColumns = ['id', 'name'];

  dataSource = new TableVirtualScrollDataSource(DATA);
}

versions
"dependencies": { "@angular/animations": "^19.1.0", "@angular/cdk": "^19.1.2", "@angular/common": "^19.1.0", "@angular/compiler": "^19.1.0", "@angular/core": "^19.1.0", "@angular/forms": "^19.1.0", "@angular/material": "^19.1.2", "@angular/platform-browser": "^19.1.0", "@angular/platform-browser-dynamic": "^19.1.0", "@angular/router": "^19.1.0", "ng-table-virtual-scroll": "^1.6.1", "rxjs": "~7.8.0", "tslib": "^2.3.0", "zone.js": "~0.15.0" },

@imbesci imbesci changed the title Base example no longer works Base example no longer works in latest Angular versions Feb 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant