ngrid
ngrid copied to clipboard
Wrong context row data in TargetEventsPlugin with vScrollAuto and RouteReuseStrategy
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 [email protected], [email protected], [email protected], [email protected], [email protected]. 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>