diprokon / ng-table-virtual-scroll

Virtual Scroll for Angular Material Table
https://diprokon.github.io/ng-table-virtual-scroll
MIT License
137 stars 42 forks source link

multi table #93

Open zeuz10 opened 2 years ago

zeuz10 commented 2 years ago

doesn't seem to be working I have the following code:

ts file<<<<<<<<< this.tables = []; this.tables.push(new TableVirtualScrollDataSource(this.dataSourceDetalle.filter(f => f.WERKS == tienda) .sort((a,b) => (a.SBDEPTO < b.SBDEPTO) ? 1 : ((b.SBDEPTO < a.SBDEPTO) ? -1 : 0))) );

HTML file <<<<<<<<< <cdk-virtual-scroll-viewport tvsItemSize class="wrapper mat-elevation-z2"> \<table mat-table [dataSource]="table" *ngFor="let table of tables" matSort [class]="status=='d' ? 'light-blue':''"> . . . having about a matrix for about 300 rows and 200+ columns spread along 3 generated tables

diprokon commented 2 years ago

Not sure how to help you Did you import all required modules? Can you provide stackblitz example?

zeuz10 commented 2 years ago

Yes, all modules are in place, the table was working before the virtual scroll. I don't have the stackblitz example, let me work on that

zeuz10 commented 2 years ago

After a while of debugging, I have the following Headers, footers main issue was that for the data to get the footers I used the table object and not table.data or table.filteredData but no content. instead, I get this error

ERROR TypeError: Cannot read properties of undefined (reading '_switchDataSource') at TableItemSizeDirective.ngAfterContentInit (ng-table-virtual-scroll.mjs:187:40)

I believe is some kind of configuration, data comes from the server in an http.get request from HttpClient so ngAfterContentInit is empty until data arrives. this is the rendered data \<tbody role="rowgroup">\<!--ng-container-->\<!--ng-container-->\</tbody>

the thing is... I get all the calculated data from the table in the footers