infor-design / enterprise

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

Datagrid: Unify the logic for passing row identifier in various methods #8645

Open kwolentarski opened 5 months ago

kwolentarski commented 5 months ago

Describe the bug

Currently datagrid methods are not consistent with the way they calculate row identifier. Examples:

  1. Using lineage, which causes bugs as top level rows don't have lineage so it will return data-index and direct child has lineage equal to data-index of parent (see in dev tools here: https://main-enterprise.demo.design.infor.com/components/datagrid/test-post-renderer-tree.html) image
  2. Row index: image
  3. Dataset index passed to formatter (rowHtml method): image

Expected behavior The row index passed for methods/events should be consistent across whole datagrid

Version

Platform

tmcconechy commented 5 months ago

@kwolentarski the lineage is for trees, so is it really needed in non trees? Will be a lot of work to add it to every event safely.

kwolentarski commented 5 months ago

I'm more than fine with not using lineage in postRenderCell, that was just example of a case where the row is different. In some cases we would still like to use trees, and have those methods return consistently the row index.

In our current use case we are using onPostRenderCell, onDestroyCell and formatter together in Angular to cache the components instead of recreating them. Key for this cache is depending on the row value passed to those events, so we need it to be consistent in order for it to work properly. I think aria-rowindex is the most unique one and consistent, so maybe this one is a good candidate.

tmcconechy commented 4 months ago

@kwolentarski I think what we need is a test case we can use for this? Could you give me an example of onPostRenderCell and onDestroyCell? Are they NOT omitting the data.

Having a bit of an issue scoping this one as "various" when i think we need more exact cases? We added the code quality label because im not clear if its broken for what it omits or this is a general code quality suggestion.