shlomiassaf/ngrid

PblNgridCellEvent rowIndex not matching _rowIndex inside PblNgridRowComponent

phantasma2983 opened this issue · 0 comments

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