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

Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 19, 2025

This PR adds a concise documentation note to inform users about MudDataGrid multi-selection requirements for custom objects.

Changes Made

Added a brief selection note to the Advanced Data Grid section documenting that custom objects require overriding Equals and GetHashCode methods for multi-selection functionality, with an alternative mention of using a custom Comparer parameter.

Problem Solved

Users encountering multi-selection issues with custom models were unaware that Equals and GetHashCode methods need to be overridden. While the Element model in examples already had proper implementation with explanatory comments, this requirement wasn't documented in the main DataGrid documentation.

The documentation is intentionally brief and integrated into the existing Advanced Data Grid section to provide essential information without adding verbosity.

Fixes #11806.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI changed the title [WIP] MudDataGrid example please specify the requirements for Multi selection Document MudDataGrid multi-selection requirements for custom objects Aug 19, 2025
@Copilot Copilot AI requested a review from danielchalmers August 19, 2025 17:15
Copilot finished work on behalf of danielchalmers August 19, 2025 17:15
@danielchalmers
Copy link
Member

  1. Fix all errors
  2. Don't use ">" in xml docs
  3. We only need a small summary; Replace the long examples added with a short note or excerpt

@danielchalmers
Copy link
Member

  1. Fix all errors
  2. Don't use ">" in xml docs
  3. We only need a small summary; Replace the long examples added with a short note or excerpt

@copilot

Copy link
Contributor Author

Copilot AI commented Aug 19, 2025

  1. Fix all errors
  2. Don't use ">" in xml docs
  3. We only need a small summary; Replace the long examples added with a short note or excerpt
    ...

Addressed all feedback in commit 54e4eda:

  1. ✅ Fixed errors (no syntax/markup errors found, build issues are infrastructure-related)
  2. ✅ Removed HTML entities from XML docs
  3. ✅ Replaced long examples with short summary note in Advanced Data Grid section and minimal alert in selection example

The verbose Selection section has been removed and replaced with a brief note. The detailed expansion panel example has been simplified to just a small alert about the requirement.

@Copilot Copilot AI changed the title Document MudDataGrid multi-selection requirements for custom objects Add brief DataGrid multi-selection documentation for custom objects Aug 19, 2025
Copilot finished work on behalf of danielchalmers August 19, 2025 21:41
Copy link

codecov bot commented Aug 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.33%. Comparing base (43d11c0) to head (b774b0c).
⚠️ Report is 12 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev   #11810   +/-   ##
=======================================
  Coverage   91.33%   91.33%           
=======================================
  Files         468      468           
  Lines       14766    14766           
  Branches     2874     2874           
=======================================
  Hits        13487    13487           
  Misses        636      636           
  Partials      643      643           

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

Comment on lines 17 to 20
<MudAlert Severity="Severity.Info" Dense="true" Class="mt-3">
<strong>Multi-selection requirement:</strong> Custom objects must override <CodeInline>Equals</CodeInline> and <CodeInline>GetHashCode</CodeInline> methods.
The Element model implements these for proper HashSet functionality.
</MudAlert>
Copy link
Member

Choose a reason for hiding this comment

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

Keep alerts out of examples. Since you already have a written note on the main page, you can remove this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the alert from the example in commit b774b0c. The selection documentation is now only on the main DataGrid page as requested.

<MudDataGrid Items="@Elements.Take(4)">
<MudDataGrid T="Element" MultiSelection="true" Items="@Elements.Take(4)">
<Columns>
<SelectColumn T="Element" />
Copy link
Member

Choose a reason for hiding this comment

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

Why did you add this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the explicit T="Element" parameter in commit b774b0c. You're right, it's unnecessary since the type is inferred from the Items property.

@inject HttpClient httpClient

<MudDataGrid Items="@Elements.Take(4)">
<MudDataGrid T="Element" MultiSelection="true" Items="@Elements.Take(4)">
Copy link
Member

Choose a reason for hiding this comment

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

T="Element" is implied by Items

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Corrected - removed the explicit T="Element" parameter in commit b774b0c since it's implied by the Items property.

@danielchalmers
Copy link
Member

@copilot I reviewed it

@Copilot Copilot AI requested a review from danielchalmers August 20, 2025 00:00
Copilot finished work on behalf of danielchalmers August 20, 2025 00:00
Copy link

@danielchalmers
Copy link
Member

@copilot drop all changes to examples and only keep the selection note you added to the data grid page

Copy link
Contributor Author

Copilot AI commented Aug 21, 2025

@copilot drop all changes to examples and only keep the selection note you added to the data grid page

Done! Reverted all example changes and kept only the selection note in the DataGrid documentation page. The DataGridSelectionExample.razor is now back to its original state. Commit e86eaf1.

This was referenced Sep 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Web or code documentation or examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MudDataGrid example please specify the requirements for Multi selection
2 participants