hjalmers / angular-generic-table

A generic table for Angular 2+. Generic table uses standard markup for tables ie. table, tr and td elements etc. and has support for expanding rows, global search, filters, sorting, pagination, export to CSV, column clicks, custom column rendering, custom export values.
https://hjalmers.github.io/angular-generic-table/
MIT License
104 stars 55 forks source link

Add, remove or edit rows Angular RxJx 6.3.3 #295

Closed klalle closed 6 years ago

klalle commented 6 years ago

I am using the beta-version for angular 7, and this works fine, but I get one error message when code compiles. Since RxJs is updated I had to rewrite: this.edit = source.scan(prev => !prev, true); to: this.edit = source.pipe(scan(prev => !prev, false)); in file: add-remove-edit.component.ts and imports like: import { BehaviorSubject, Observable, Subject} from 'rxjs'; import { scan, startWith, filter, take} from 'rxjs/operators';

This compiles successfully, and works, but with an error message:

ERROR in src/app/add-remove-edit/add-remove-edit.component.ts(156,29): error TS2345: Argument of type 'MonoTypeOperatorFunction<boolean>' is not assignable to parameter of type 'OperatorFunction<string, boolean>'. Types of parameters 'source' and 'source' are incompatible. Type 'Observable<string>' is not assignable to type 'Observable<boolean>'. Type 'string' is not assignable to type 'boolean'. src/app/add-remove-edit/add-remove-edit.component.ts(157,29): error TS2345: Argument of type 'MonoTypeOperatorFunction<boolean>' is not assignable to parameter of type 'OperatorFunction<string, boolean>'.

Any idéa of how to fix this? /Kalle

app.zip

klalle commented 6 years ago

Solved it... changed it to: this.edit = source.pipe(scan<string, boolean>(prev => !prev, true)); this.view = source.pipe(scan<string, boolean>(prev => !prev, false));

Angular: 7.1.1 rxjs 6.3.3 Thanks for an awesome component! /Kalle

hjalmers commented 6 years ago

Glad you solved it, I haven't looked at the zip you provided but based on your comment I guess you had part of this code copied in your project, and just like you said, the syntax has changed in rxjs so you need to call scan in a pipe.