Primeng: Data Table 'trackBy must be a function, but received undefined'

Created on 22 Dec 2016  路  7Comments  路  Source: primefaces/primeng

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

defect

Most helpful comment

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 ?

All 7 comments

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.

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

error like this.

primengerror

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 ?

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...

Created an issue at;

https://github.com/angular/angular/issues/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.

1.1.2 is released it's solving this problem for now

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jisqaqov picture jisqaqov  路  3Comments

cyberrranger picture cyberrranger  路  3Comments

just-paja picture just-paja  路  3Comments

KannanMuruganmony picture KannanMuruganmony  路  3Comments

markgoho picture markgoho  路  3Comments