primeng icon indicating copy to clipboard operation
primeng copied to clipboard

DataTable with Virtual Scroll flickers

Open wooleverj opened this issue 9 years ago • 25 comments

I'm submitting a ... (check one with "x")

[X] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Plunkr Case (Bug Reports) http://plnkr.co/edit/V3JY3MASoc1Dh2pm5IJO?p=preview

https://www.primefaces.org/primeng/#/datatable/scroll

Related to this support request: https://forum.primefaces.org/viewtopic.php?f=35&t=51675&sid=997449c59e643d44aed79a1461037caf

Current behavior When using the table with virtual scroll, if you scroll down to where the lazy load gets fired the table will continually fire the lazy load event. This causes the table to flicker with data loading and never actually complete loading the data until you scroll further down or back up to before the lazy load event fired. This appears to only be an issue when the viewport is showing part of the original loaded data and part of the new loaded data.

Expected behavior The expected behavior is for the the data to load to the table without continually firing the lazy load event.

Minimal reproduction of the problem with instructions You can clearly see the issue on the example virtual scroll table in the demo. If you scroll the second table to the point in which lazy load event occurs the table will flicker and never complete loading.

What is the motivation / use case for changing the behavior? Table loading is not working properly.

Please tell us about your environment: Windows 2010, Visual Studio Code, node.js, npm

  • Angular version: 2.0.X 4.0 +

  • PrimeNG version: 2.0.X Checked this issue with 4.0.3, 4.1.0-rc2, 4.1.0-rc3, 4.1.0 and it seems to manifest in all of them.

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Chrome 59

  • Language: [all]

wooleverj avatar Jul 12 '17 15:07 wooleverj

It works in Firefox, but not in Chrome.

filip12345678910 avatar Jul 17 '17 13:07 filip12345678910

Looks like the scroll event is firing when it shouldn't which is causing the table to continuously scroll down when the first lazyLoad event is fired. There are a couple of issues that seem to be causing this:

  1. ScrollableView.prototype.ngAfterViewChecked - the call to this.alignScrollBar() causes the scroll event to trigger which causes this.bodyScrollListener to fire. The issue might be in the alignScrollBar() function or the bodyScrollListener function.

  2. DataTable.prototype.ngAfterViewChecked - the last line in the second if block looks like it should be setting this.totalRecordsChanged = false otherwise that block of code will re-execute every time ngAfterViewChecked is fired.

machfalcon avatar Jul 18 '17 20:07 machfalcon

Hi, I'm working with LazyLoad and scrolling and do struggling with this behavior, too. I mainly work with Firefox, but unfortunatley there is the same strange behavior. If you could fix this as soon as possible I would be happy, because this functionality is much-needed for our program. :) thx.

aabruc avatar Aug 09 '17 10:08 aabruc

Dear PrimeNG team, I'm using LazyLoad with scrolling in my project as well. I have the same strange behaviour in IE(11), Edge, Chrome and Firefox ... With this bug it's not really usable :(

When do you think will you fix this issue? Is it already planned for an upcoming version? I'm really looking forward for this bugfix! :)

Thank you!

fehart avatar Aug 10 '17 14:08 fehart

Can you guys check this with 4.1.3?

cagataycivici avatar Aug 25 '17 14:08 cagataycivici

Hi! I've got 4.1.3, but unfortunately there is no improvement. The table content still flickers when you scroll and when you reach the last element, the scrollbar does not fit, its too long.

aabruc avatar Aug 28 '17 10:08 aabruc

I also upgraded to 4.1.3 and did not see any improvement to the data table flickering.

wooleverj avatar Aug 28 '17 16:08 wooleverj

Same issue for me, still not working in 4.1.3

ekoch avatar Aug 29 '17 09:08 ekoch

same here, still not working with 4.1.3 :(

fehart avatar Aug 29 '17 09:08 fehart

You have to scroll slowly.

filip12345678910 avatar Aug 29 '17 10:08 filip12345678910

But we can't ask our users to scroll slowly ... ;) Also it doesn't work correctly if you scroll slowly!

fehart avatar Aug 29 '17 11:08 fehart

You have to scroll slowly to make the bug work. When I scroll fast the bug doesn't happen.

filip12345678910 avatar Aug 29 '17 11:08 filip12345678910

Ah, ok. Well, for us it doesn't work correctly if you scroll fast or slowly ...

fehart avatar Aug 29 '17 11:08 fehart

I'll add a timer so that if the user scrolls too fast, we don't call lazy load.

cagataycivici avatar Sep 04 '17 09:09 cagataycivici

Upgraded to 4.2.0 and the flickering is still there. Just scroll to the point when new data is supposed to be loaded. Any updates?

https://plnkr.co/edit/CoSqvdoZkVnA4vDpSMWD?p=preview

goluhaque avatar Sep 13 '17 10:09 goluhaque

Works better if you scroll fast - but it's still flickering and "jumping" when you scroll slowly.

fehart avatar Sep 13 '17 10:09 fehart

Maybe we should make a video if he doesn't understand.

filip12345678910 avatar Sep 19 '17 07:09 filip12345678910

We could make a video, but I don't think the issue is too hard to verify or a working solution too hard to test.

goluhaque avatar Sep 19 '17 07:09 goluhaque

But cagataycivici seems to have no idea what are we talking about.

filip12345678910 avatar Sep 21 '17 11:09 filip12345678910

I guess he knows what we talking about, because after the bugfix it works much better: The scrollbar size is calculated right, the content is loaded correctly, the last element can be reached and it stops at the last element. That wasn't the case in the version before.

But it needs an improvement: When you scroll with mousewheel and scroll slowly, it's still flickering and jumping. So much so that you feel the content is not loaded properly.

aabruc avatar Sep 22 '17 13:09 aabruc