shlomiassaf / ngrid

A angular grid for the enterprise
https://shlomiassaf.github.io/ngrid
MIT License
241 stars 41 forks source link

PblNgridCellEvent rowIndex not matching _rowIndex inside PblNgridRowComponent #285

Open phantasma2983 opened 1 year ago

phantasma2983 commented 1 year ago

What is the current behavior?

I have a complex ngrid table using vScrollFixed and Global Templates.

After multiple datasource refreshes some rows have the wrong rowIndex inside viewCache so I get the "Cannot read properties of undefined (reading 'rowContext')" error.

After some debugging I figured out that when building the viewCache the _rowIndex of the row in question is different than the expected one and thus is saved in viewCache under a different key. What ends up happening is when createCellEvent is created is can't find the rowIndex in viewCache since it's under a different id. This caused the context of the PblNgridCellEvent to be undefined. I'm not sure if this problem is being caused by Angular CDK or something inside NGrid.

What are the steps to reproduce?

I can always reproduce the issue after multiple datasource refreshes and scrolls through the table but sometimes it takes more than 3-4 datasource refreshes to show up. I haven't figured out the pattern.

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

Angular: v14-lts on all packages (including cdk and cdk-experimental) NGrid: 5.0.0