Skip to content

MudDataGrid: Allow to plug any filter type handler#6626

Draft
ScarletKuro wants to merge 8 commits intoMudBlazor:devfrom
ScarletKuro:datagrid_abstraction
Draft

MudDataGrid: Allow to plug any filter type handler#6626
ScarletKuro wants to merge 8 commits intoMudBlazor:devfrom
ScarletKuro:datagrid_abstraction

Conversation

@ScarletKuro
Copy link
Member

@ScarletKuro ScarletKuro commented Apr 11, 2023

Description

This is an early prototype for an idea that can be found here: #6049 (comment). Essentially, it allows to wire up any type to the filter. For example, if there is a lack of support for TimeOnly, one can implement their own FilterTypeBase and add the corresponding UI part to handle it.

Initially, I had a simple idea:

public interface ITypeFilter
{
	bool CanBeMapped { get; }
	RenderFragment RenderFilterFragment<T>(FilterDefinition<T> filterDefinition, Filter<T> filter);
}

However, I encountered the issue of an external render fragment interfering with the render lifecycle and throwing an error: System.InvalidOperationException: 'The render handle is not yet assigned.'

I attempted three prototypes before settling on the current implementation, which uses DynamicComponent and ensures that the render lifecycle works correctly. My previous prototypes required "hacks" that probably wouldn't be accepted, which is why I decided to go with the current solution.

How Has This Been Tested?

Unit test + new unit tests(incoming)

Types 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)

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 Adds a new feature or enhances existing functionality (not fixing a defect) in the main library label Apr 11, 2023
@ScarletKuro
Copy link
Member Author

This solution is still in the early stages of development and requires further polishing, but would it address the issue you raised @sjd2021?

FYI, @henon and @tjscience, I would appreciate your overall thoughts on this concept / idea whatever we need such flexibility.

@sjd2021
Copy link

sjd2021 commented Apr 11, 2023 via email

@codecov
Copy link

codecov bot commented Apr 11, 2023

Codecov Report

Attention: Patch coverage is 85.45455% with 8 lines in your changes missing coverage. Please review.

Project coverage is 90.64%. Comparing base (367f359) to head (164d921).
Report is 1755 commits behind head on dev.

Files with missing lines Patch % Lines
...Components/DataGrid/FilterType/FilterTypeMapper.cs 68.42% 6 Missing ⚠️
...rc/MudBlazor/Components/DataGrid/TypeIdentifier.cs 83.33% 2 Missing ⚠️

❌ Your patch check has failed because the patch coverage (85.45%) is below the target coverage (100.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #6626      +/-   ##
==========================================
+ Coverage   90.62%   90.64%   +0.02%     
==========================================
  Files         399      407       +8     
  Lines       13584    13625      +41     
==========================================
+ Hits        12310    12350      +40     
- Misses       1274     1275       +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.

@github-actions

This comment was marked as off-topic.

@github-actions github-actions bot added the stale Issue or PR has had no activity and is subject to automatic closure if not updated label Jul 19, 2025
@danielchalmers danielchalmers removed the stale Issue or PR has had no activity and is subject to automatic closure if not updated label Jul 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Adds a new feature or enhances existing functionality (not fixing a defect) in the main library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants