Skip to content

Conversation

@Mil4n0r
Copy link
Collaborator

@Mil4n0r Mil4n0r commented Jun 11, 2025

Checklist

  • Build process is done without errors. All tests pass in the /lib directory.
  • Self-reviewed the code before submitting.
  • Meets accessibility standards.
  • Added/updated documentation to /website as needed.
  • Added/updated tests as needed.

Purpose
The idea of the change is being able to handle highly nested data in a more appropiate way. With the previous API we were forcing the users to load the whole dataset inside the rows item from the DxcDatagrid. Which is not feasible most of the time due to big performance impact.

Description
In order to achieve that purpose, a new prop has been added to the component, loadChildren?: (expandChildren: HierarchyGridRow) => HierarchyGridRow[] | Promise<HierarchyGridRow[]>;. As its name says, it is an additional way of setting the children for a hierarchical data, this data can come from any type of source and is specially useful for lazy loading purposes (until you click on the expand button, the children data for that node is not processed).

Additional context
There are still some edge cases which have to be reviewed as well as including additional documentation, testing and stories for the component.

@Mil4n0r Mil4n0r marked this pull request as ready for review June 12, 2025 08:22
@Mil4n0r
Copy link
Collaborator Author

Mil4n0r commented Jun 12, 2025

Should we add a mechanism to display a spinner while the data is being loaded when setting the loadChildren function?

@Jialecl
Copy link
Collaborator

Jialecl commented Jun 25, 2025

Should we add a mechanism to display a spinner while the data is being loaded when setting the loadChildren function?

They are able to use the Spinner component easily without any mechanism from the datagrid

Copy link
Collaborator

@Jialecl Jialecl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to discuss about this approach because I find issues with delays in case the children are not returned instantly.

@Jialecl Jialecl self-assigned this Jul 7, 2025
@Jialecl
Copy link
Collaborator

Jialecl commented Jul 21, 2025

Updates missing in the documentation.

@Jialecl
Copy link
Collaborator

Jialecl commented Jul 22, 2025

There are still problems with the selection.
You can select other rows or the select all row and it won't be taken into account once the rows are rendered.
Maybe we should consider a global state for all the checkboxes instead of a row state.

@Jialecl
Copy link
Collaborator

Jialecl commented Jul 25, 2025

There is just one small bug I was able to reproduce:
image

It seems to be related to collapsed grandchildren while selected are stored in the selected row set and stayed on the list after unselected.

@Jialecl Jialecl merged commit 06033b0 into master Jul 28, 2025
4 checks passed
@Jialecl Jialecl deleted the Mil4n0r/lazy-load-datagrid branch July 28, 2025 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants