irossimoline / angular4-material-table

Angular 4 table based on @angular/cdk table structure, to allow row insertion, edition, validation and deletion.
MIT License
55 stars 25 forks source link

TypeError: undefined is not an object (evaluating 'this.dataKeys.reduce') #29

Closed lrochas closed 5 years ago

lrochas commented 5 years ago

Hi! In the TableDataSource class / createNewObject function I get this error when I try to create a new element: ERROR - TypeError: undefined is not an object (evaluating 'this.dataKeys.reduce') wether by invoking (click)="dataSource.createNew()" in the view or when calling's the this.dataSource.createNew();function in the component. I'm not trying to innovate for the moment. Just trying to import StackBlitz's code in my app.

When I do a console.log(this.dataConstructor);and a console.log(this.dataKeys);inside the createNewObject()function both are undefined.

Any idea on how to solve this?

lrochas commented 5 years ago

Fresh install resolved the issue. Forget! Thanks for sharing your code.