DataTable still propagating endless onLazyLoad events - previous case #1434 #1502

Closed
davisruk opened this Issue Dec 5, 2016 · 3 comments

Projects

None yet

4 participants

@davisruk
davisruk commented Dec 5, 2016

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)
Please fork the plunkr below and create a case demonstrating your bug report. Issues without a plunkr have much less possibility to be reviewed.

http://plnkr.co/edit/NtWWnN

Current behavior

Same as #1434 which was marked as fixed for 1.0.1. A Datatable with lazyLoad=true and a filter with a value propagates endless onLazyLoad events when the Datatable's underlying data array is altered e.g. items added or removed. The problem is in the ngDoCheck function where the lazyLoad check still calls the filter function:
if (this.hasFilter()) { if (this.lazy) { //prevent loop if (this.stopFilterPropagation) this.stopFilterPropagation = false; else this.filter(); } else { this.filter(); }
Expected behavior

The component should create one onLazyLoad event. Removing the call to this.filter within the lazyLoad check fixes the problem.
if (this.hasFilter()) { if (this.lazy) { //prevent loop if (this.stopFilterPropagation) this.stopFilterPropagation = false; //else //this.filter(); } else { this.filter(); }
Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?

See previous case (#1434)
Please tell us about your environment:

See previous case (#1434)

  • Angular version: 2.0.X

See previous case (#1434)

  • PrimeNG version: 2.0.X

1.0.1

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

See previous case (#1434)

  • Language: [all | TypeScript X.X | ES6/7 | ES5]
    See previous case (#1434)
  • Node (for AoT issues): node --version =
    See previous case (#1434)
@no0dles
no0dles commented Dec 15, 2016

same issue here, lazy loading and filters are enabled.

Without a filter value everything works fine, but after setting a filter value it loads the filtered content once and as soon as you try to navigate to the second page the loop begins. It also resets the "first" value to 0.

@crimpphantom

I have add an example for this issue: http://plnkr.co/edit/3643a4

@cagataycivici cagataycivici added the review label Jan 5, 2017
@cagataycivici cagataycivici added this to the 2.0 milestone Jan 5, 2017
@cagataycivici cagataycivici self-assigned this Jan 5, 2017
@cagataycivici cagataycivici added defect and removed review labels Jan 11, 2017
@cagataycivici
Member

Fix checked in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment