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

MatVirtualScroll Items are not rendered if height is not defind in pixel #696

Open
alexandreberton opened this issue Aug 25, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@alexandreberton
Copy link

alexandreberton commented Aug 25, 2020

I found a bug in MatVirtualScroll.

If I put this code all items are not displayed when I scrolled down (only 41 items are displayed instead of 73):

<MatVirtualScroll @ref="_lazyLoading" style="overflow-y: auto; height: 100vh" ItemType="DTO.MusteringCardholderDetails" Items="@FilteredCardHolders" ItemHeight="60">
Same thing if I put height like 300px the scrollbar is here but I cannot see all of my items (44 in this case instead of 73)

To fix it quickly in my code I decide to change the height by setting 100% instead of 100vh or XXXpx. And in this case no items are displayed. The scrollbar is displayed and the right place in allocate to the scrollbar but the component don't display anything. I try also to remove ItemHeight but same result.

The only way I found to display all results is to harcode a value which is bigger to my real size (in my case 4380px or higher). The problem is my list is my list is dynamic so it is definitely not a right way.

I also try something like that in the code but it does not compile:
style="overflow-y: auto; height:@(this.ScrollSize)px;"

private int ScrollSize => this.FilteredCardHolders.Count * 60;

Can someone take a lool at this ?

Thanks

@alexandreberton alexandreberton added the bug Something isn't working label Aug 25, 2020
@alexandreberton
Copy link
Author

I find a solution by fixing one stuff in the library.
My main problem was when scrollviewer + Lazy loading is enabled not all items are displayed.

I will do a pull request for that.

Thanks

alexandreberton pushed a commit to alexandreberton/MatBlazor that referenced this issue Sep 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant