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

Data Table 'trackBy must be a function, but received undefined' #1652

Closed
agusdutra opened this issue Dec 22, 2016 · 7 comments
Closed

Data Table 'trackBy must be a function, but received undefined' #1652

agusdutra opened this issue Dec 22, 2016 · 7 comments
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@agusdutra
Copy link

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

Current behavior
I was using primeng 1.0.0 and angular 2.2.1. I've updated primeng to 1.1.1 and angular to 2.4.1

On the last version Datatable worked fine, without the rowTrackBy (I don't need it)
After I updated, the same datatable, without any changes, throws me this error and doesn't render any rows.

Expected behavior
Show rows of the data table .

Minimal reproduction of the problem with instructions
Use simple datatable primeng on angular 2.4.1 and primeng 1.1.1

Environment:
WebStorm 2016.3
Angular version: 2.4.1
PrimeNG version:1.1.1
Browser:all

Stack trace:

captura de pantalla 2016-12-21 a las 22 55 34

files.zip

@agusdutra
Copy link
Author

I've reverted my dependencies back to angular 2.2.1 just like it was before, and the table renders with no problem, without any further changes.

@zhangwei8387
Copy link

I have the same problem. I created a very simple Datatable .
my angular is 2.4
primeng 1.1.1

error like this.

primengerror

@bogacg
Copy link

bogacg commented Dec 22, 2016

Same here, upgraded to PrimeNg 1.1.1 and Angular 2.4.1, get same error for dataTables
UPDATE: Reverted back to Angular 2.3.1, PrimeNg left v. 1.1.1, seems to work so far, though I'm not happy each time Angular updates somethings get broken. Isn't this against SEMVER ?

@Mrtcndkn Mrtcndkn added the Status: Pending Review Issue or pull request is being reviewed by Core Team label Dec 22, 2016
@Emdee89
Copy link

Emdee89 commented Dec 22, 2016

I can also confirm that it works with PrimeNG 1.1.1 and Angular 2.4.0, however it does break with Angular 2.4.1 then...

@cagataycivici
Copy link
Member

Created an issue at;

angular/angular#13641

On our side, we can create a dummy function as default value, @Mrtcndkn please do so and release 1.1.2 as DataTable is unusable now with 2.4.1.

@cagataycivici cagataycivici self-assigned this Dec 23, 2016
@cagataycivici cagataycivici added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Pending Review Issue or pull request is being reviewed by Core Team labels Dec 23, 2016
@cagataycivici cagataycivici added this to the 1.1.2 milestone Dec 23, 2016
@Mrtcndkn
Copy link
Contributor

1.1.2 is released it's solving this problem for now

@ribizli
Copy link

ribizli commented Dec 27, 2016

I'm not sure that the default implementation makes it:

rowTrackBy: Function = () => {};

Because now everything is tracked by undefined, which is returned from the function above. Angular uses the identity function as default.

trackByIdentity = (index: number, item: any) => item;

A haven't had time to test this, but I'm pretty sure this can make some performance problems, since DefaultIterableDiffer cannot really track for changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

No branches or pull requests

7 participants