-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
MudDataGrid: Add hierarchy visibility toggled parameter #11706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MudDataGrid: Add hierarchy visibility toggled parameter #11706
Conversation
Check to see if this duplicates any of #11292 |
So should we close this one if we merge that one? Or does that one have anything this one doesn't? You did the work would be nice to get some credit. |
I think these are two unrelated issues, so you can merge both. |
Merged #11292 - new conflicts on this PR I'll try to get both merged before the next release |
@GeorgeKarlinzer If you'll bring this branch up to date, ensure the tests still pass and that it solves your problem then tag me I'll review and we'll get it merged as soon as we can. |
88fca2f
to
4e126db
Compare
@versile2 all done :) |
There was a problem hiding this 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 adds a HierarchyVisibilityToggled
parameter to the MudDataGrid component that allows users to perform custom actions when grid rows are expanded or collapsed.
- Added
HierarchyVisibilityToggled
EventCallback parameter to trigger custom actions on hierarchy visibility changes - Created
DataGridHierarchyVisibilityToggledEventArgs
class to provide event information - Updated hierarchy methods to invoke the new event callback when items are expanded/collapsed
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
MudDataGrid.razor.cs | Added HierarchyVisibilityToggled parameter and event invocations in hierarchy management methods |
DataGridHierarchyVisibilityToggledEventArgs.cs | New event args class containing item and expanded state information |
DataGridTests.cs | Added unit tests for the new hierarchy visibility toggled functionality |
DataGridHierarchyVisibilityToggledTest.razor | Test component demonstrating the new event callback usage |
/// <summary> | ||
/// The item whose visibility was changed. | ||
/// </summary> | ||
public T Item { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Item property should have an initializer or be marked as required to prevent null reference issues, as this is event args data that should always contain a valid item.
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure here, most other event args don't have a setter and instead set during constructor which is basically the same thing as required.
/// </summary> | ||
public T Item { get; set; } | ||
/// <summary> | ||
/// If <code>true</code> item was expanded, otherwise collapsed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation comment uses inconsistent formatting. It should use backticks instead of tags for inline code: 'If
true
item was expanded, otherwise collapsed'.
Suggested change
/// If <code>true</code> item was expanded, otherwise collapsed
/// If `true` item was expanded, otherwise collapsed
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the backticks isn't right, however <c>
does what you want here, <code>
just makes it separate a line. Remember you can always mouse over the property to see what it will look like in Intellisense.
if (!_buttonDisabledFunc(item) && _openHierarchies.Add(item)) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Add operation is performed even when the item is already in the set. Consider checking if the item exists first to avoid unnecessary event invocations: if (!_buttonDisabledFunc(item) && !_openHierarchies.Contains(item))
.
if (!_buttonDisabledFunc(item) && _openHierarchies.Add(item)) | |
{ | |
if (!_buttonDisabledFunc(item) && !_openHierarchies.Contains(item)) | |
{ | |
_openHierarchies.Add(item); |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that this is not the case, the HashSet<T>.Add
method description explicitly says that false is returned when an item is already in the set. Demo: https://dotnetfiddle.net/bZE8nb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look at sonarcube report. I don't have access to a computer right now but can that part be simplified based on a LINQ where?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
The pull request introduces a new HierarchyVisibilityToggled
parameter to the MudDataGrid component, enabling users to perform custom actions when a row's hierarchy is expanded or collapsed. The changes include modifications to the MudDataGrid component and the addition of a new event argument class, along with corresponding unit tests.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #11706 +/- ##
======================================
Coverage ? 91.31%
======================================
Files ? 467
Lines ? 14728
Branches ? 2870
======================================
Hits ? 13449
Misses ? 636
Partials ? 643 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work.
Thanks! |
Add
HierarchyVisibilityToggled
parameter on MudDataGrid component, that allows user to perform custom actions when row is expanded/collapsed. The parameter is triggered when grid row is expanded or collapsed.Checklist:
dev
).