Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

ScarletKuro
Copy link
Member

Description

Original PR: #11083 I screwed up and have to open a new PR.
Introduce Multi Level Grouping to MudDataGrid without any breaking changes.
Resolves #7587
Resolves #5654
Created two-way bind for GroupExpanded and GroupByOrder
Also consolidated logic for showing items in DataGridVirtualizeRow

image

How Has This Been Tested?

Visually, Unit Tests

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 and others added 30 commits March 9, 2025 21:33
- Updated grouping functions in `DataGridGroupingMultiLevelTest.razor` to handle nullable values.
- Enhanced rendering structure in `DataGridGroupRow.razor` for better maintainability.
- Added constructor and refactored properties in `DataGridGroupRow.razor.cs`.
- Replaced `_allGroups` with `_groupDefinitions` in `MudDataGrid.razor` for structured group management.
- Significant refactor in `MudDataGrid.razor.cs` to support multi-level grouping with new classes.

- V2
- Updated `DataGridGroupingMultiLevelTest.razor` to improve grouping functionality.
- Restructured HTML in `DataGridGroupRow.razor` for better readability.
- Commented out unused `DataGridGroupData` class in `DataGridGroupRow.razor.cs`.
- Required `DataGrid` and `Items` parameters in `DataGridGroupRow`.
- Improved table rendering logic in `MudDataGrid.razor`.
- Changed visibility of properties in `MudDataGrid.razor.cs` for better encapsulation.
- Refined grouping logic in `MudDataGrid.razor.cs`.
- Added `DataGridVirtualizeRow.razor` for row virtualization.
- Created `DataGridVirtualizeRow.razor.cs` to define logic for the new component.

- V2
- Modified `PropertyColumn` elements in `DataGridGroupingMultiLevelTest.razor` to include the `Grouping` attribute.
- Updated item resolution logic in `DataGridVirtualizeRow.razor` to handle grouped scenarios correctly.
- Made the `ProcessGroup` method static in `MudDataGrid.razor.cs` for improved performance and clarity.
- Added a line to store the selector of the current group in a `selectors` list.

- V2
- Enclosed `else if` condition in braces in `DataGridVirtualizeRow.razor` for better readability.
- Updated comments in `MudDataGrid.razor.cs` to replace "group" with "groupedColumns" for clarity.
- Modified group processing logic to consistently use "groupedColumns" terminology.
- Introduced `AddGroupItems` method to enhance the hierarchy building of grouped columns.

- V2
Replaced `_lastGroup` and `_groupDefinitions` with a single `_groupDefinition` variable to simplify grouping logic. Introduced `_groupedItems` for direct storage of grouped items, enhancing clarity and maintainability. Updated grouping logic to support hierarchical multi-level grouping. Modified expand and collapse methods to use the new `_groupDefinition`.
- Modified `GroupStyleFunc` to allow null assignment.
- Simplified `SetGroupingAsync` in `Column.razor.cs`.
- Added null checks in `DataGridGroupRow.razor` for safety.
- Introduced `_innerGroupItems` in `DataGridGroupRow.razor.cs`.
- Added `SyncInnerGroupItems` method for better synchronization.
- Cleaned up `MudPopover` attributes in `MudDataGrid.razor`.
- Removed unused variables and methods in `MudDataGrid.razor.cs`.

- V2
- Changed grouping parameter handler to synchronous in Column.razor.cs.
- Refactored click event for group expansion in DataGridGroupRow.razor.
- Updated CSS class names for group indentation in DataGridGroupRow.razor.cs.
- Added DataGrid.ChangedGrouping() calls in HeaderCell.razor.cs to ensure state updates.
- Enhanced styling structure in _datagrid.scss for improved row indentation.
Introduce internal state parameters for group expansion and order in the Column class.
Add event callbacks for GroupByOrder and GroupExpanded changes. Update the Expanded property in DataGridGroupRow to use a backing field for better state management.
Refactor group expansion and collapse methods to support asynchronous operations.
Overall improvements for better handling of grouped rows in the data grid.
- Updated event handlers back to asynchronous methods.
- Simplified properties in `DataGridGroupRow.razor.cs` using auto-implemented properties.
- Enhanced `GetGroupDefinitions` for better group management.
- Updated `DataGridGroupRow` to utilize new grouping logic.

- V2
- Made `DataGridAggregationTest` asynchronous and added `await` for `ExpandAllGroups`.
- Removed unnecessary `using` directives in `CategoryAttribute.cs`  - new static class `DataGrid` with constants for various data grid categories.
- Annotated properties in `DataGridGroupRow.razor.cs` with `Category` attributes for better organization.
- Added `Category` attributes to properties in `DataGridVirtualizeRow.razor.cs`.

- V2
Copy link

codecov bot commented Apr 26, 2025

Codecov Report

Attention: Patch coverage is 83.73984% with 20 lines in your changes missing coverage. Please review.

Project coverage is 91.08%. Comparing base (50c881d) to head (4e25bc2).

Files with missing lines Patch % Lines
...MudBlazor/Components/DataGrid/MudDataGrid.razor.cs 81.25% 9 Missing and 3 partials ⚠️
...azor/Components/DataGrid/DataGridGroupRow.razor.cs 83.33% 1 Missing and 3 partials ⚠️
...dBlazor/Components/DataGrid/DataGridGroupRow.razor 71.42% 0 Missing and 2 partials ⚠️
...c/MudBlazor/Components/DataGrid/GroupDefinition.cs 84.61% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev   #11243      +/-   ##
==========================================
- Coverage   91.10%   91.08%   -0.03%     
==========================================
  Files         436      439       +3     
  Lines       14145    14229      +84     
  Branches     2731     2758      +27     
==========================================
+ Hits        12887    12960      +73     
- Misses        637      639       +2     
- Partials      621      630       +9     

☔ 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.

@ScarletKuro ScarletKuro merged commit 7b4a2bc into dev Apr 26, 2025
12 of 13 checks passed
@ScarletKuro ScarletKuro deleted the pr/11083 branch April 26, 2025 19:19
@henon
Copy link
Collaborator

henon commented Apr 29, 2025

Sorry this comes a bit late, but there is a way to merge a PR with multiple authors so @versile2 's authorship could have been marked into the commit. I don't remember exactly off the top of my head how but I have done it before and I just wanted to tell you so we can look it up and do it right next time. Big thanks to @versile2 for doing most of the work on this!

@ScarletKuro
Copy link
Member Author

I set @versile2 as co-author, idk if I can set him as main author

@versile2
Copy link
Contributor

@henon @ScarletKuro

Thanks for thinking of me, but I will make it clear I do like accolades but that's not why I do it. I enjoy it. And frankly @ScarletKuro fixes enough of my code and helps me improve so I should probably be sub author :P

Thanks @ScarletKuro

@henon
Copy link
Collaborator

henon commented Apr 30, 2025

I set @versile2 as co-author, idk if I can set him as main author

I see. I was misled by github then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Request for adding a new feature or enhancing existing functionality (not fixing a defect)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MudDataGrid multi level grouping MudDataGrid add Grouping on multi levels
3 participants