Skip to content

MudDataGrid: Fix HierarchyColumn Expansion with Funcs#11292

Merged
danielchalmers merged 6 commits intoMudBlazor:devfrom
versile2:fix/datagridhierarchyinitial
Jul 30, 2025
Merged

MudDataGrid: Fix HierarchyColumn Expansion with Funcs#11292
danielchalmers merged 6 commits intoMudBlazor:devfrom
versile2:fix/datagridhierarchyinitial

Conversation

@versile2
Copy link
Contributor

@versile2 versile2 commented May 5, 2025

Description

Moved InitiallyExpandedFunc logic to MudDataGrid by passing it through Template Column. Adjusted methods that calculate items to include this when supplied and logical.
Additionally passed ButtonDisabledfunc the same way, ensuring ExpandAll and CollapseAll Hierarchies ignore disabled.
Resolves #9681
Resolves #11289
Resolves #11291

How Has This Been Tested?

Additional unit tests and updated unit tests.
Visually in WASM and BSS.

Type of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (fix or improvement to the website or code docs)

Checklist

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

versile2 added 2 commits May 5, 2025 13:59
…hies. Adjusted tests to only show 4 hierarchies when one is disabled.
@github-actions github-actions bot added bug Unexpected behavior or functionality not working as intended PR: needs review labels May 5, 2025
@codecov
Copy link

codecov bot commented May 5, 2025

Codecov Report

❌ Patch coverage is 95.12195% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.35%. Comparing base (a3727bf) to head (b8f0d5b).
⚠️ Report is 46 commits behind head on dev.

Files with missing lines Patch % Lines
...MudBlazor/Components/DataGrid/MudDataGrid.razor.cs 95.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##              dev   #11292   +/-   ##
=======================================
  Coverage   91.35%   91.35%           
=======================================
  Files         466      466           
  Lines       14697    14726   +29     
  Branches     2853     2862    +9     
=======================================
+ Hits        13426    13453   +27     
- Misses        632      633    +1     
- Partials      639      640    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@versile2 versile2 requested a review from ScarletKuro May 5, 2025 20:24
@sonarqubecloud
Copy link

sonarqubecloud bot commented May 5, 2025

@danielchalmers danielchalmers changed the title DataGrid - Hierarchy Column Updates - InitiallyExpandedFunc MudDataGrid: Hierarchy Column Updates - InitiallyExpandedFunc May 26, 2025
@versile2
Copy link
Contributor Author

@ScarletKuro Any chance you can look at this one maybe this weekend?

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR moves the InitiallyExpandedFunc logic to MudDataGrid and routes it via the Template Column while also passing ButtonDisabledFunc so that hierarchy expansion and collapse respect disabled states. Key changes include adding new parameters to TemplateColumn, updating MudDataGrid expansion/collapse methods, and revising unit tests to account for the disabled state.

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/MudBlazor/Components/DataGrid/TemplateColumn.cs Added parameters InitiallyExpandedFunc and ButtonDisabledFunc
src/MudBlazor/Components/DataGrid/MudDataGrid.razor.cs Added fields and methods to handle initial expansion and button disabled logic; updated hierarchy expansion methods
src/MudBlazor/Components/DataGrid/HierarchyColumn.razor.cs Removed legacy initial expansion state handling and modified parameter types
src/MudBlazor/Components/DataGrid/HierarchyColumn.razor Updated TemplateColumn usage to pass additional parameters
Unit Test Files Adjusted expected counts and tests to reflect the new behavior with disabled items

@danielchalmers
Copy link
Member

danielchalmers commented Jun 11, 2025

@TheGreenAirplane @willBrereton @Axium7 Hi, this PR should help your reported issues - If you can download the repo and give it a try it will help us ensure your apps work in the upcoming release!

@danielchalmers danielchalmers changed the title MudDataGrid: Hierarchy Column Updates - InitiallyExpandedFunc MudDataGrid: Fix HierarchyColumn Expansion with Funcs Jun 11, 2025
@versile2
Copy link
Contributor Author

versile2 commented Jun 12, 2025

Instructions to create a test mudblazor nuget:

🔧 Testing a MudBlazor PR Locally in Your App

  1. Clone and checkout the PR:
git clone https://github.com/MudBlazor/MudBlazor.git
cd MudBlazor
git fetch origin pull/11292/head:pr-branch
git checkout pr-branch
  1. Pack MudBlazor with a custom version:
dotnet pack src/MudBlazor/MudBlazor.csproj -c Release -o ./LocalNuget -p:Version=8.0.0-custom
  1. Add a nuget.config in your app folder:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
    <add key="LocalMud" value="C:\Path\To\MudBlazor\LocalNuget" />
    </packageSources>
</configuration>
  1. Update your app’s .csproj:
<PackageReference Include="MudBlazor" Version="8.0.0-custom" />
  1. Restore and build:
dotnet restore
dotnet build

✅ You’re now using the PR version of MudBlazor!

@sonarqubecloud
Copy link

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

5 participants