I populate a grid with the following line of code:
this.gridData$ = this.userService.getUsers();
and this is the corresponding HTML:
[kendoGridBinding]="(gridData$ | async)!"
It works as expected.
I have also a delete button. Clicking the button deletes the user. After that I want to remove the user from the list, but withount making an extra HTTP request. I tried shareReplay
, but the extra request is there:
this.gridData$ = this.gridData$.pipe(
shareReplay({ bufferSize: 1, refCount: true }),
map((users) => {
return users.filter(
(user) => user.userId !== this.currentDataItem.userId
);
})
);
How to filter the grid data in order to delete the deleted user without any extra HTTP request? Or should I store the users in a local variable on init, and modify the array upon adding, edit or delete and convert this to an observable?