Skip to content

MudDataGrid: Configuration using expressions#6049

Merged
henon merged 24 commits intoMudBlazor:devfrom
tjscience:expression-property
Mar 1, 2023
Merged

MudDataGrid: Configuration using expressions#6049
henon merged 24 commits intoMudBlazor:devfrom
tjscience:expression-property

Conversation

@tjscience
Copy link
Contributor

Description

resolves #4567
PR references #5816

This PR is meant to track the changes required to support a property expression as opposed to a string field. The early draft PR is to allow the community and core team to evaluate the progress of this feature as I am developing it out. It is still rough at this point and I have to go through all of the tests, create more and also add better documentation.

I believe that I have fixed up all of the trimming issues as well.

How Has This Been Tested?

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.

@mikes-gh mikes-gh changed the title Expression property MudDataGrid: Column configuration using expressions Dec 28, 2022
@mikes-gh mikes-gh added enhancement Adds a new feature or enhances existing functionality (not fixing a defect) in the main library breaking change This change will require consumer code updates API change Modifies the public API surface labels Dec 28, 2022
@mikes-gh
Copy link
Contributor

@tjscience Thanks for the PR. Just a note the root of this branch is way back in time and hence the conflicts. I would advise rebasing this to the head of dev ASAP before doing any more work.

@mikes-gh mikes-gh changed the title MudDataGrid: Column configuration using expressions MudDataGrid: Configuration using expressions Dec 28, 2022
@mikes-gh
Copy link
Contributor

@tjscience I guess you know but this isn't building.

@tjscience
Copy link
Contributor Author

@mikes-gh, it is a rough draft. The whole purpose was to get the foundation out there to be viewed by others. If you want to take a look you should be able to build and run the wasm host project (and obviously every dependency underneath). It is going to take time to go through all of the tests to fix all that this change broke.

@mikes-gh
Copy link
Contributor

mikes-gh commented Dec 28, 2022

@tjscience check the build errors. I cant build MudBlazor :-)

@henon
Copy link
Contributor

henon commented Jan 20, 2023

@tjscience: do you have a rough time frame for this PR? I am not pressing you, it is just that as a team we want to plan on how long we are going to have to suppress DataGrid PRs from others. Thanks.

@tjscience
Copy link
Contributor Author

I would like to say end of the month but I have been extremely busy with my day job. I will try and devote some time to it this weekend and next week though. The heavy lifting is done. Primarily, all that is left is fixing all of the tests and putting in more examples.

@mikes-gh
Copy link
Contributor

@tjscience Could you get this building? Not concerned with the tests for now but it would be good to have it building at least so others could test for you.

@tjscience
Copy link
Contributor Author

I am able to build and run the wasm host just fine. Can you give a bit more details about what is failing in the build for you?

image

@mikes-gh
Copy link
Contributor

mikes-gh commented Jan 21, 2023

The error is in the PR build logs.
https://github.com/MudBlazor/MudBlazor/actions/runs/3796194555/jobs/6456054155#step:7:14
These are my local build logs (I only include MudBlazor.dll build to make it shorter)
I am guessing you must be using different code locally.

PS /Users/mikes/Documents/Repos/MudBlazor>  cd ./src/MudBlazor
PS /Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor> dotnet build

Welcome to .NET 7.0!
---------------------
SDK Version: 7.0.102

Telemetry
---------
The .NET tools collect usage data in order to help us improve your experience. It is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.

Read more about .NET CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry

----------------
Installed an ASP.NET Core HTTPS development certificate.
To trust the certificate run 'dotnet dev-certs https --trust' (Windows and macOS only).
Learn about HTTPS: https://aka.ms/dotnet-https
----------------
Write your first app: https://aka.ms/dotnet-hello-world
Find out what's new: https://aka.ms/dotnet-whats-new
Explore documentation: https://aka.ms/dotnet-docs
Report issues and find source on GitHub: https://github.com/dotnet/core
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli
--------------------------------------------------------------------------------------
MSBuild version 17.4.1+9a89d02ff for .NET
  Determining projects to restore...
  Restored /Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj (in 4.1 sec).
  Tool 'excubo.webcompiler' (version '2.7.12') was restored. Available commands: webcompiler
  
  Restore was successful.
  Tool 'excubo.webcompiler' (version '2.7.12') was restored. Available commands: webcompiler
  
  Restore was successful.
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterHeaderCell.razor(52,18): error RZ1034: Found a malformed 'MudMenu' tag helper. Tag helpers must have a start and end tag or be self closing. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net7.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(55,32): warning CS8600: Converting null literal or possible null value to non-nullable type. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net7.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(69,119): warning CS8604: Possible null reference argument for parameter 'value' in 'bool string.StartsWith(string value, StringComparison comparisonType)'. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net7.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(71,117): warning CS8604: Possible null reference argument for parameter 'value' in 'bool string.EndsWith(string value, StringComparison comparisonType)'. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net7.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(14,33): warning CS8618: Non-nullable property 'DataGrid' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net7.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(18,26): warning CS8618: Non-nullable property 'Column' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net7.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(19,23): warning CS8618: Non-nullable property 'Field' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net7.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(20,23): warning CS8618: Non-nullable property 'Title' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net7.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(21,21): warning CS8618: Non-nullable property 'FieldType' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net7.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(22,23): warning CS8618: Non-nullable property 'Operator' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net7.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(23,23): warning CS8618: Non-nullable property 'Value' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net7.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(24,30): warning CS8618: Non-nullable property 'FilterFunction' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net7.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Base/MudFormComponent.cs(587,72): warning IL2075: 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperty(String)'. The return value of method 'System.Linq.Expressions.Expression.Type.get' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net7.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Extensions/ExpressionExtensions.cs(41,60): warning IL2075: 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperty(String)'. The return value of method 'System.Linq.Expressions.Expression.Type.get' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net7.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterHeaderCell.razor(52,18): error RZ1034: Found a malformed 'MudMenu' tag helper. Tag helpers must have a start and end tag or be self closing. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net6.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(55,32): warning CS8600: Converting null literal or possible null value to non-nullable type. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net6.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(69,119): warning CS8604: Possible null reference argument for parameter 'value' in 'bool string.StartsWith(string value, StringComparison comparisonType)'. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net6.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(71,117): warning CS8604: Possible null reference argument for parameter 'value' in 'bool string.EndsWith(string value, StringComparison comparisonType)'. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net6.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(14,33): warning CS8618: Non-nullable property 'DataGrid' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net6.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(18,26): warning CS8618: Non-nullable property 'Column' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net6.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(19,23): warning CS8618: Non-nullable property 'Field' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net6.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(20,23): warning CS8618: Non-nullable property 'Title' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net6.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(21,21): warning CS8618: Non-nullable property 'FieldType' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net6.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(22,23): warning CS8618: Non-nullable property 'Operator' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net6.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(23,23): warning CS8618: Non-nullable property 'Value' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net6.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(24,30): warning CS8618: Non-nullable property 'FilterFunction' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net6.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Base/MudFormComponent.cs(587,72): warning IL2075: 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperty(String)'. The return value of method 'System.Linq.Expressions.Expression.Type.get' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net6.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Extensions/ExpressionExtensions.cs(41,60): warning IL2075: 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperty(String)'. The return value of method 'System.Linq.Expressions.Expression.Type.get' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net6.0]

Build FAILED.

/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(55,32): warning CS8600: Converting null literal or possible null value to non-nullable type. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net7.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(69,119): warning CS8604: Possible null reference argument for parameter 'value' in 'bool string.StartsWith(string value, StringComparison comparisonType)'. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net7.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(71,117): warning CS8604: Possible null reference argument for parameter 'value' in 'bool string.EndsWith(string value, StringComparison comparisonType)'. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net7.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(14,33): warning CS8618: Non-nullable property 'DataGrid' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net7.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(18,26): warning CS8618: Non-nullable property 'Column' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net7.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(19,23): warning CS8618: Non-nullable property 'Field' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net7.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(20,23): warning CS8618: Non-nullable property 'Title' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net7.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(21,21): warning CS8618: Non-nullable property 'FieldType' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net7.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(22,23): warning CS8618: Non-nullable property 'Operator' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net7.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(23,23): warning CS8618: Non-nullable property 'Value' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net7.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(24,30): warning CS8618: Non-nullable property 'FilterFunction' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net7.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Base/MudFormComponent.cs(587,72): warning IL2075: 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperty(String)'. The return value of method 'System.Linq.Expressions.Expression.Type.get' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net7.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Extensions/ExpressionExtensions.cs(41,60): warning IL2075: 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperty(String)'. The return value of method 'System.Linq.Expressions.Expression.Type.get' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net7.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(55,32): warning CS8600: Converting null literal or possible null value to non-nullable type. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net6.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(69,119): warning CS8604: Possible null reference argument for parameter 'value' in 'bool string.StartsWith(string value, StringComparison comparisonType)'. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net6.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(71,117): warning CS8604: Possible null reference argument for parameter 'value' in 'bool string.EndsWith(string value, StringComparison comparisonType)'. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net6.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(14,33): warning CS8618: Non-nullable property 'DataGrid' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net6.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(18,26): warning CS8618: Non-nullable property 'Column' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net6.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(19,23): warning CS8618: Non-nullable property 'Field' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net6.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(20,23): warning CS8618: Non-nullable property 'Title' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net6.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(21,21): warning CS8618: Non-nullable property 'FieldType' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net6.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(22,23): warning CS8618: Non-nullable property 'Operator' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net6.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(23,23): warning CS8618: Non-nullable property 'Value' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net6.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterDefinition.cs(24,30): warning CS8618: Non-nullable property 'FilterFunction' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net6.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Base/MudFormComponent.cs(587,72): warning IL2075: 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperty(String)'. The return value of method 'System.Linq.Expressions.Expression.Type.get' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net6.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Extensions/ExpressionExtensions.cs(41,60): warning IL2075: 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperty(String)'. The return value of method 'System.Linq.Expressions.Expression.Type.get' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net6.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterHeaderCell.razor(52,18): error RZ1034: Found a malformed 'MudMenu' tag helper. Tag helpers must have a start and end tag or be self closing. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net7.0]
/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/Components/DataGrid/FilterHeaderCell.razor(52,18): error RZ1034: Found a malformed 'MudMenu' tag helper. Tag helpers must have a start and end tag or be self closing. [/Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor/MudBlazor.csproj::TargetFramework=net6.0]
    26 Warning(s)
    2 Error(s)

Time Elapsed 00:00:39.21
PS /Users/mikes/Documents/Repos/MudBlazor/src/MudBlazor> 

@tjscience
Copy link
Contributor Author

@mikes-gh Try it out now and see if you can build.

@mikes-gh
Copy link
Contributor

mikes-gh commented Jan 25, 2023

@mikes-gh Try it out now and see if you can build.

Thanks @tjscience I can build now which is great.
When I run the project the css is not working correctly.
Maybe @henon can download and run this PR to see if its just me.

@mikes-gh
Copy link
Contributor

Ignore previous comment. After dotnet clean all ok and builds OK @tjscience 👍

@jonathan
Copy link

My team uses MudDataGrid's pretty extensively. Is there a timeline on when this PR might drop?

@ScarletKuro
Copy link
Member

ScarletKuro commented Apr 9, 2023

After testing it out, it looks like not being able to specify a type will be the only remaining showstopper as I still need DateOnly fields to be treated as DateTime in order to get the calendar picker going

We are aware of the problem with TimeOnly / DateOnly and it will be addressed once the major bugs in the DataGrid are fixed.

I've got a hacky solution for MudDatePicker to support DateOnly

How does your hacky solution look? MudDatePicker supports a Converter where you can supply your own converter and map DateOnly to DateTime, which is a legitimate solution. For this reason, there is no native support for TimeOnly in MudTimePicker and DateOnly in MudDatePicker because we genuinely hope that people will use converters.

@ghost
Copy link

ghost commented Apr 10, 2023

@ScarletKuro as described by @lfhenrl, only simple filtering mode invokes server data reloading, I've also noticed that clearing the filter does not invoke sever data reloading in any mode. I've rushed an initial commit with unfinished tests and found out that there is some kind of a bug with enum filtering too (nullable enum maybe?), anyway the server data is reloaded now, maybe you'd like to add some comments while I finish.

@ScarletKuro
Copy link
Member

@alfadelta88 doesn't the ReloadServerData gets triggered twice in FilterHeaderCell because ClearFilter() it also calling the void ClearFilter(FilterDefinition<T> filterDefinition) and they both have the Reload call.

@ghost
Copy link

ghost commented Apr 10, 2023

@ScarletKuro you're absolutely right, i'll fix it and push it along with the tests in a bit.

@ScarletKuro
Copy link
Member

ScarletKuro commented Apr 10, 2023

@alfadelta88 now when #6614 is merged. We can make much better design for you changes.

As all the methods in FilterHeaderCell and HeaderCell are internal and only used in our handlers I suggest changing the signature of the methods that call DataGrid.ReloadServerData() to return a Task and add an "-Async" suffix. And then consider using await instead of .AndForget().

Example:
from this

internal void ClearFilter()
{
	...
	if (DataGrid.ServerData != null) DataGrid.ReloadServerData().AndForget();
	...
}

to

internal async Task ClearFilterAsync()
{
	...
	if (DataGrid.ServerData != null) await DataGrid.ReloadServerData();
	...
}

This will be not a breaking change, because all the methods are internal and only used inside our components and not exposed, all places that call these methods support returning a Task due to this change #6614.

@henon FYI

@ghost
Copy link

ghost commented Apr 10, 2023

@ScarletKuro great, I'll make necessary changes.

@sjd2021
Copy link

sjd2021 commented Apr 10, 2023

We are aware of the problem with TimeOnly / DateOnly and it will be addressed once the major bugs in the DataGrid are fixed.

The issue for me here is that this actually works fine in the previous version (as you could just set the type to DateTime), so it means the next stable release will have removed functionality that can't be replicated if we wait to handle DateOnly across the board instead of supporting it in the filter again. I know it's experimental though, so it's fair game. I was just hoping that, if I had the time/opportunity, I could sneak in a compatible candidate before the next release.

How does your hacky solution look? MudDatePicker supports a Converter where you can supply your own converter and map DateOnly to DateTime, which is a legitimate solution. For this reason, there is no native support for TimeOnly in MudTimePicker and DateOnly in MudDatePicker because we genuinely hope that people will use converters.

Does the converter work for server data? For some reason, I was under the impression that this was more so for inline data. I was using this suggested workaround, basically (we just changed the inheritance and cascaded extra attributes for better parity): #6178 (comment)

@henon
Copy link
Contributor

henon commented Apr 10, 2023

@sjd2021 wrote: [...] I'll need to dig into the source code a bit more to see what our options would be for getting the OOB date filter to appear for DateOnly with MudDataGrid. If I come up with something there, is that likely to make it in with the other grid fixes?

Yes, if you want to PR DateOnly support for DataGrid date filter please go ahead. You can tag us in your PR for speedy review. If we release before you are done we can also make a pre-release nuget for you once your PR is in. Just make sure you have good test coverage of your changes.

@ScarletKuro
Copy link
Member

My idea to address this problem is to create an easy abstraction called ITypeFilterMapper with an API like this:

public interface ITypeFilterMapper
{
	Type Type { get; }
	RenderFragment RenderFilterFragment<T>(FilterDefinition<T> filterDefinition, Column<T> column);
}

This new abstraction can be passed to the DataGrid component. We would define on our side for common mappers for types like String, Boolean, DateTime etc Users can also implement this interface to add support for any custom type they want.
The DataGrid will iterate through the list of ITypeFilterMapper and render the necessary fragment.

foreach (ITypeFilterMapper mapper in TypeFilterMapper)
{
	if (filterDefinition.Type == mapper.Type)
	{
		RenderFilterFragment(filterDefinition, filter, column);
	}
}

With this approach, users have the flexibility to add any type they want without having to modify the DataGrid component directly.
Our current solution is that for each type we make a if-clause

@if (filterDefinition.FieldType.IsDateOnly)
{
<HTML CODE>
}

And this is not flexible at all.

This is just a high level abstraction that was in my head.

@ghost
Copy link

ghost commented Apr 10, 2023

@ScarletKuro I pushed a commit to this branch with the relevant tests, if you could take a look when you have the time. This commit breaks two tests the first is DataGridColumnPopupCustomFilteringTest which I'm investigating and the second is DataGridFilterableServerDataTest which I think should be invalidated as the filtering should happen at server level when ServerData is defined but the latter expects results with filtering at the client level.

@ghost
Copy link

ghost commented Apr 10, 2023

@ScarletKuro Btw, with ColumnFilterRow the ReloadServerData is invoked immediately when a character is inputted in a string filter or a number in a numeric filter which is not viable, I think, there should be a public parameter to set DebounceInterval to avoid too many server requests, for now I've used a fixed value of 1 second (in the next commit), what do you think?

@tjscience
Copy link
Contributor Author

@ScarletKuro Btw, with ColumnFilterRow the ReloadServerData is invoked immediately when a character is inputted in a string filter or a number in a numeric filter which is not viable, I think, there should be a public parameter to set DebounceInterval to avoid too many server requests, for now I've used a fixed value of 1 second (̶i̶n̶ ̶t̶h̶e̶ ̶n̶e̶x̶t̶ ̶c̶o̶m̶m̶i̶t̶)̶, what do you think?

1 second seems like too much of a delay. I think that 500ms would be better to default to.

@ghost
Copy link

ghost commented Apr 11, 2023

1 second seems like too much of a delay. I think that 500ms would be better to default to.

@tjscience You're right, I'll adjust it in the next commit.

@neozhu
Copy link
Contributor

neozhu commented Apr 11, 2023

I am really looking forward to the release of the MudDataGrid component。

@henon
Copy link
Contributor

henon commented Apr 11, 2023

@alfadelta88 why don't you create a PR? You can push to it even after you created it, and we can comment and discuss.

@ScarletKuro
Copy link
Member

Yeah, you can make it a draft as well. It will be much easier.

@ghost
Copy link

ghost commented Apr 11, 2023

@henon @ScarletKuro sure, here #6627

@sjd2021
Copy link

sjd2021 commented Aug 2, 2023

....

@if (filterDefinition.FieldType.IsDateOnly)
{
<HTML CODE>
}

And this is not flexible at all.

This is just a high level abstraction that was in my head.

I was out for an extended period of time - how does the team feel about this approach? Is it even favorable (regarding your comment about it not being flexible)?

@ScarletKuro have the other major issues with the data grid been resolved such that timeonly/dateonly support is workable? I was looking to upgrade beyond 6.1.9 soon so we can leverage the latest fixes and features for other components. Regardless, I'd like to know the team's opinion on the aforementioned suggestion.

@henon
Copy link
Contributor

henon commented Aug 11, 2023

@sjd2021 MudDataGrid has matured, so yes you can work on dateonly and timeonly support without causing conflicts. As for your question, I can't answer it. Maybe @tjscience can.

@tjscience
Copy link
Contributor Author

@henon and @sjd2021 The problem with the @if (filterDefinition.FieldType.IsDateOnly) pattern is that it is becoming unwieldy and it increases complexity each time we need to add a type. I am in favor of @ScarletKuro proposed solution here. This way all of the types can be managed more easily and overridden by the dev. If this is too much work at this point Kuro, we can go ahead and just implement TimeOnly and DateOnly right now and work on the mapper later.

@ScarletKuro
Copy link
Member

ScarletKuro commented Aug 14, 2023

If this is too much work at this point Kuro, we can go ahead and just implement TimeOnly and DateOnly right now and work on the mapper later.

There is prototype that works #6626, but I still don't fully like the implementation. I will later try to revive work on it.

@tjscience
Copy link
Contributor Author

@ScarletKuro, I do not see this implemented cell's edit rendering. Was that a miss, or just not gotten to yet?

@ScarletKuro
Copy link
Member

ScarletKuro commented Aug 14, 2023

@ScarletKuro, I do not see this implemented cell's edit rendering. Was that a miss, or just not gotten to yet?

Not gotten yet, the point was firstly to find an adequate abstraction to dynamically hookup filter parts depending on the type, then everything rest.

ilovepilav pushed a commit to ilovepilav/MudBlazor that referenced this pull request Nov 25, 2023
MudDataGrid: Configuration using expressions (MudBlazor#6049)

Co-authored-by: Terry Phillips <[email protected]>
@henon henon added the legendary Marks contributions that are highly valuable, innovative, or significantly impactful to the project label Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API change Modifies the public API surface breaking change This change will require consumer code updates enhancement Adds a new feature or enhances existing functionality (not fixing a defect) in the main library legendary Marks contributions that are highly valuable, innovative, or significantly impactful to the project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MudDataGrid: Support Column with Func Field Pointer