infor-design / enterprise

Enterprise-grade component library for the Infor Design System
https://design.infor.com
Apache License 2.0
133 stars 81 forks source link

Datagrid: adding a row in a filtered grid results in corruption #8905

Closed DavidMoerman closed 3 weeks ago

DavidMoerman commented 1 month ago

Describe the bug When using the grid filters to filter out records first, and then adding a record, the grid's internal references are not updated correctly and this will lead to data corruption. An example is the row click event, which will provide the data for another record than is actually shown on screen.

To Reproduce I have changed the datagrid-add-row.demo.ts and datagrid-add-row.demo.html files from the enterprise-ng project. The problem itself is not related to angular, however. The updated files are attached to this issue. To reproduce:

  1. first filter on the name by typing 'o' in the filter box.
  2. Then fill in 'order' in the edit box at the top
  3. and press Add row.
  4. If you click on the last record shown ('Prop') , the 'Selected Record' field at the bottom will shown 'Abc' instead.
  5. When you remove the filter, the problem will disappear.

The problem is caused by a wrong index on the tag.

Version v4.97.0

Screenshots I have attached a video that demoes the steps taken to reproduce the problem.

datagrid.zip

https://github.com/user-attachments/assets/24b54922-8da6-4597-97b1-2da9ea261c39

tmcconechy commented 1 month ago

@DavidMoerman Can you explain what you mean about the problem is on an index on a tag? Are you seeing a fix you can PR for this?

DavidMoerman commented 1 month ago

@DavidMoerman Can you explain what you mean about the problem is on an index on a tag? Are you seeing a fix you can PR for this?

I noticed that the [tr] tags contain references to the dataset, and that those references get mixed up. But I do not know where and why this happens.

tmcconechy commented 1 month ago

ok thanks @DavidMoerman ~ what do you mean by the "index on a tag"?

DavidMoerman commented 1 month ago

ok thanks @DavidMoerman ~ what do you mean by the "index on a tag"?

image

it's the data-index on the tr tag that gets corrupted; in this example, in the actual dataset this is the fourth element (position 3 counted from 0): image