Reactive Forms - Grid - Kendo question

1 Answer 92 Views
Designs, skins, themes
Woojin
Top achievements
Rank 1
Woojin asked on 19 Nov 2021, 05:53 PM | edited on 19 Nov 2021, 05:55 PM

Hi. I have been looking through this example for my project: https://www.telerik.com/kendo-angular-ui/components/grid/editing/editing-reactive-forms/

 

Can somebody explain to me what ngOnInit does? Particularly `this.editService.pipe...` It seems like it's calling all the data and assigning it to `this.view.` I specially don't get what "pipe" does because the editService doesn't seem to have a method called "pipe" either. Anyway, if someone can clarify what's happening here, that'd be great. Thank you

public ngOnInit(): void {

this.view = this.editSerivce.pipe(

 map((data) => process(data, this.gridState))

}

1 Answer, 1 is accepted

Sort by
0
Svet
Telerik team
answered on 24 Nov 2021, 09:40 AM

Hi Woojin,

Thank you for the provided details.

this.view is a type of Observable which allows to subscribe to it within the Grid template using the async pipe:

 public view: Observable<GridDataResult>;

      <kendo-grid
          [data]="view | async"
...

this.editService is a service of type EditService which extends the BehaviorSubject type which is basically an Observable:

@Injectable()
export class EditService extends BehaviorSubject<any[]> {

That is why this.editService has a pipe() method which further allows to map the data.

I hope the provided details help. Please let me know in case any further information is required for this case.

Regards,
Svet
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Designs, skins, themes
Asked by
Woojin
Top achievements
Rank 1
Answers by
Svet
Telerik team
Share this question
or