Closed riwos closed 4 years ago
I've created PR: https://github.com/diprokon/ng-table-virtual-scroll/pull/8 - The problem is with method 'getViewportSize()' when on this case always returns zero.. Have a look for quick fix on my PR @diprokon ;)
Hi @riwos ! Thanks for your contributing, I very appreciate this! With your example and PR, it was very easy to understand and found the problem :)
The problem really is in the 'getViewportSize()', but it looks like it is not in scope of this directive. It appears when you combine cdk-virtual-scroll-viewport with mat-tabs. Please, check this ticket: https://github.com/angular/components/issues/15622
As a solution, your PR will force people to provide the directive with more data, what is not necessary. I will like to avoid this. On the other hand, the directive, can sometimes call the 'checkViewportSize()' of the viewport, but this operation is not cheap and it will be better to know, when it is required. Considering all this, I propose to call 'checkViewportSize()' outside of the directive, when you change the tab. I made a workaround for your example: https://stackblitz.com/edit/angular-material-tab-example-d14bat?file=src/app/app.component.ts
Please, check it and let me know what you think about it
Hi @diprokon ,
I did not know that issue already exists. I am big fan of sentence: "less code is better" so I will cancel my PR because of we do not need anymore :) Your solution is everything what I need so far 👍
I do not know what do you think but I have noticed that method 'updateContent()' and then internal method 'getViewportSize()' is called every time when you scroll down but the value is always that same like height who is defined on inline styles. Maybe we could call this method only once. I do not know that it is a big improvement and does it have impact for performance but maybe you can consider ;)
However thank you for you support !! Happy I have this solution :)
You feel free to close this ticket.
This is kind of problematic... I have the Mat Tab in a parent component than the child components that use the VirtualScroll 😕
🐞 BUG REPORT
Description When using angular material tab (8.2.3) and then you are trying scroll on down then data is gone for some reason.. You must refresh page to get table with data again..
🔬 Minimal Reproduction https://stackblitz.com/edit/angular-material-tab-example-uca6w3
🔥 Exception or Error None
🌍 Your Environment
Any ideas ??
ps. Awesome solution. I am glad and happy you did it !! Many thanks 🗡