Skip to content

MudDataGrid: Hierarchy ExpandAll/CollapseAll when one item is present#11904

Merged
ScarletKuro merged 4 commits intoMudBlazor:devfrom
versile2:fix-datagrid-11899
Sep 22, 2025
Merged

MudDataGrid: Hierarchy ExpandAll/CollapseAll when one item is present#11904
ScarletKuro merged 4 commits intoMudBlazor:devfrom
versile2:fix-datagrid-11899

Conversation

@versile2
Copy link
Contributor

Resolves #11899 by setting the Expanded count > 0 instead of > 1

Checklist:

  • The PR is submitted to the correct branch (dev).
  • My code follows the style of this project.
  • I've added relevant tests or confirmed existing ones.

Created a failing unit test
Made adjustment until it passed

@mudbot mudbot bot added the bug Unexpected behavior or functionality not working as intended label Sep 22, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request resolves an issue where ExpandAll and CollapseAll functionality in MudDataGrid did not work correctly when there was only one item. The core change correctly adjusts the logic for determining the expanded state in HeaderCell.razor.cs by checking if the count of open hierarchies is greater than zero, instead of greater than one. A new unit test has been added to verify this fix, which is a great addition. The changes are logical and effectively address the reported bug. I have one minor suggestion to improve code clarity by removing a redundant call to StateHasChanged.

@ScarletKuro
Copy link
Member

What about title: MudDataGrid: Fix ExpandAll/CollapseAll when only item item is present (or something like that)?

@mudbot mudbot bot changed the title MudDataGrid: ExpandAll and CollapseAll Counting MudDataGrid: Fix ExpandAll/CollapseAll when only one item is present Sep 22, 2025
@ScarletKuro
Copy link
Member

ScarletKuro commented Sep 22, 2025

Lol, the bot changed the title before even getting other opinions xD

@versile2
Copy link
Contributor Author

What about title: MudDataGrid: Hierarchy ExpandAll/CollapseAll when one item is present
Since both grouping and hierarchy have an expand all and collapse all

@ScarletKuro ScarletKuro changed the title MudDataGrid: Fix ExpandAll/CollapseAll when only one item is present MudDataGrid: Hierarchy ExpandAll/CollapseAll when one item is present Sep 22, 2025
@ScarletKuro ScarletKuro merged commit d5407cc into MudBlazor:dev Sep 22, 2025
5 of 6 checks passed
@ScarletKuro ScarletKuro deleted the fix-datagrid-11899 branch September 22, 2025 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Unexpected behavior or functionality not working as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hierarchy Expand / Collapse doesn't work with single Detail Record

2 participants