shlomiassaf / ngrid

A angular grid for the enterprise

Home Page:https://shlomiassaf.github.io/ngrid

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong context row data in TargetEventsPlugin with vScrollAuto and RouteReuseStrategy

romgerman opened this issue · comments

What is the expected behavior?

When using rowClick row data should be of the clicked row.

What is the current behavior?

When using RouteReuseStrategy with route caching, PblNgridRowEvent event.root?.context?.row returns data of the rows around clicked row (and first time the row itself) when you return to the grid page.

What are the steps to reproduce?

Scroll a little (to ~140). Click on a row. Go back and find the row and click again (maybe multiple times). In the console you'll see that the id in the row data is different each time (and the row data)

https://stackblitz.com/edit/pebula-ngrid-starter-cd8gfz?file=src/app/components/grid-page/grid-page.component.ts

Which versions of Angular, CDK, Material, NGrid, OS, TypeScript, browsers are affected?

In my project its angular@14.2.12, cdk@14.2.4, material@14.2.4, ngrid@5.0.0, typescript@4.7.2. Any browser.

Is there anything else we should know?

Also reproduces with vScrollFixed
Workaround is to use click event on pbl-ngrid-row with pblNgridRowOverride directive

<pbl-ngrid-row *pblNgridRowOverride="let row" row (click)="clickRow($event, row)"></pbl-ngrid-row>