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

Skip to content

Conversation

christianielsen
Copy link
Contributor

@christianielsen christianielsen commented Jun 2, 2025

Description

This PR adds the AllowUnsorted property from MudTable to force the user to sort between Ascending and Descending without the None state.

How Has This Been Tested?

Unit test

Created a unit test with a new MudDataGrid with AllowUnsorted="false" setting the sort direction to Asc -> Desc -> Asc

Visually

before:
Screen Recording 2025-06-02 at 19 51 17

after:
Screen Recording 2025-06-02 at 19 58 12

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.

@github-actions github-actions bot added the enhancement Request for adding a new feature or enhancing existing functionality (not fixing a defect) label Jun 2, 2025
Copy link

codecov bot commented Jun 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.13%. Comparing base (7098624) to head (e89b5c4).
Report is 38 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev   #11443   +/-   ##
=======================================
  Coverage   91.13%   91.13%           
=======================================
  Files         466      466           
  Lines       14417    14418    +1     
  Branches     2792     2792           
=======================================
+ Hits        13139    13140    +1     
  Misses        641      641           
  Partials      637      637           

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

Copy link
Contributor

@Anu6is Anu6is left a comment

Choose a reason for hiding this comment

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

Fix formatting flagged in the build and add unit tests.
All good otherwise.

@christianielsen
Copy link
Contributor Author

Added unit test and fixed formatting

@christianielsen christianielsen requested a review from Anu6is June 2, 2025 20:13
@versile2
Copy link
Contributor

versile2 commented Jun 2, 2025

Added unit test and fixed formatting

Since you are in there should change the AllowSorting in HeaderCell.razor.cs to this: DataGrid?.DropContainerHasChanged(); at the end to get rid of sonarcloud angry-ism.

Copy link
Contributor

@Anu6is Anu6is left a comment

Choose a reason for hiding this comment

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

Have the test check both states of the new property

Copy link

sonarqubecloud bot commented Jun 3, 2025

@christianielsen christianielsen requested a review from Anu6is June 3, 2025 20:18
@versile2 versile2 requested a review from ScarletKuro June 4, 2025 13:21
Copy link
Member

@danielchalmers danielchalmers left a comment

Choose a reason for hiding this comment

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

Since it's been approved twice and already exists in MudTableBase it seems like a reasonable addition to me

@danielchalmers danielchalmers changed the title MudDataGrid: Add AllowUnsorted property to MudDataGrid MudDataGrid: Add AllowUnsorted property Jun 27, 2025
@danielchalmers danielchalmers merged commit 8c428f7 into MudBlazor:dev Jun 27, 2025
6 checks passed
@versile2
Copy link
Contributor

Why did we set the default to AllowUnsorted=true since that is a breaking change?
I obviously missed it in my review.
@danielchalmers Should we just leave it in?

@ScarletKuro
Copy link
Member

@danielchalmers Should we just leave it in?

You can make a quick new PR to fix that.

@versile2
Copy link
Contributor

@danielchalmers Should we just leave it in?

You can make a quick new PR to fix that.

I will do so. Feel free to close it if ya'll decide to leave it in.

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.

5 participants