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

Issues with cdk-virtual-scroll-viewport? #15

Closed
AndreasSchmid1 opened this issue Feb 19, 2019 · 7 comments
Closed

Issues with cdk-virtual-scroll-viewport? #15

AndreasSchmid1 opened this issue Feb 19, 2019 · 7 comments
Assignees
Labels

Comments

@AndreasSchmid1
Copy link

I used this plugin already successfully in 2 different angular projects and it worked great.
I have now a project where i have to use the "cdk-virtual-scroll-viewport". As soon as i add "ellipsis" everything goes basically crazy. It starts flickering, order is wrong when scroll back up and so on.

@nolafs
Copy link

nolafs commented Jun 14, 2019

Any news on this one?

@lentschi lentschi added the bug label Jun 21, 2019
@lentschi lentschi self-assigned this Jun 21, 2019
@lentschi
Copy link
Owner

@AndreasSchmid1 @nolafs
Sorry for taking so long to respond. It is hard to support an external library such as materials's cdk-virtual-scroll-viewport, because that would require me to analyze the source code of such a library in depth.

But that said, I couldn't reproduce your problem. I did a fork from material's Stackblitz example and added an ellipsis there, which seems to work just fine: https://stackblitz.com/edit/angular-1smu3f 😃

I don't doubt however that in some context what you described will happen. That might be due to the resize detection strategy you use. Have you tried using a different one than the default (e.g. ellipsis-resize-detection="window")? If that doesn't help, please provide a failing example (on StackBlitz/GitHub/...)

@Joaovtrc
Copy link

Joaovtrc commented Jul 5, 2019

Try using templateCacheSize=0

<cdk-virtual-scroll-viewport itemSize="50" class="example-viewport">
   <div *cdkVirtualFor="let item of items; templateCacheSize: 0" class="example-item">{{item}} 
   </div>
</cdk-virtual-scroll-viewport>

As the View Recycling part on the documentation to see if it works... I've had some trouble, but setting the CacheSize to 0 solved my problems...

@lentschi
Copy link
Owner

I'm closing this issue since noone provided a failing sample (StackBlitz or likewise) and the sample I provided above seems to work without issues (Actually there was one minor issue: The itemSize was incorrect, so it was a bit jumpy when using the mouse wheel, but I fixed that in the sample).

@schoste
Copy link

schoste commented Sep 16, 2020

I have still the same problem on mobile devices or if i use the chrome device simulation. "templateCacheSize: 0 " helps on scrolling down but scrolling up have the same flickering behavior like before.
If i use the items array like @lentschi in the stackblitz example everything is fine.

So i think it may be caused by my huge MatTreeFlatDataSource - only on mobile devices :(

@lentschi
Copy link
Owner

@schoste I don't think a large source could cause this - After all this is what virtual scroll is supposed to handle. But it's hard to tell without a code sample 🤔 I can only suggest that you try it with/without ngx-ellipsis and see how that affects the flickering. Also you could also try it with a different virtual scroll lib and maybe with ngx-nested-ellipsis (Rewrite of ngx-ellipsis that supports html contents. It's actually a bit slower than ngx-ellipsis, but maybe something in the different code helps your cause.)

@schoste
Copy link

schoste commented Sep 21, 2020

You are right @lentschi - it have nothing to do with the ngx-ellipsis. I have still the same behavior without it. It seems to be a Problem between the MatTreeFlatDataSource with expanded/collapsed Children and the CdkVirtualFor.
Thanks for your time & have a nice day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants