Repository: MudBlazor/MudBlazor (2026-04-21T00:49:11Z)

Issue:
Add 'is empty' and 'is not empty' filters for nullable enum columns in MudDataGrid
### Feature request type

Enhance component

### Component name

_No response_

### Is your feature request related to a problem?

Currently the only options for filtering on an enum column is and is not.


### Describe the solution you'd like

Can we add is empty and is not empty?

### Have you seen this feature anywhere else?

_No response_

### Describe alternatives you've considered

_No response_

### Pull Request

- [x] I would like to do a Pull Request

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct


Discussion:
Sorry I can not make the  Pull Request
Ok? If it was something that was ok I could potentially make one?
I'd be happy to



Patch:
diff --git a/src/MudBlazor/Components/DataGrid/FilterExpressionGenerator.cs b/src/MudBlazor/Components/DataGrid/FilterExpressionGenerator.cs
index e98abbe27f8e..93bc605f04c7 100644
--- a/src/MudBlazor/Components/DataGrid/FilterExpressionGenerator.cs
+++ b/src/MudBlazor/Components/DataGrid/FilterExpressionGenerator.cs
@@ -154,13 +154,15 @@ public static class FilterExpressionGenerator
 
         if (fieldType.IsEnum)
         {
-            if (filter.Value is null)
+            if (filter.Value is null && filter.Operator != FilterOperator.Enum.Empty && filter.Operator != FilterOperator.Enum.NotEmpty)
                 return x => true;
 
             return filter.Operator switch
             {
                 FilterOperator.Enum.Is => propertyExpression.GenerateBinary<T>(ExpressionType.Equal, filter.Value),
                 FilterOperator.Enum.IsNot => propertyExpression.GenerateBinary<T>(ExpressionType.NotEqual, filter.Value),
+                FilterOperator.Enum.Empty => propertyExpression.GenerateBinary<T>(ExpressionType.Equal, null),
+                FilterOperator.Enum.NotEmpty => propertyExpression.GenerateBinary<T>(ExpressionType.NotEqual, null),
                 _ => x => true
             };
         }
diff --git a/src/MudBlazor/Components/DataGrid/FilterOperator.cs b/src/MudBlazor/Components/DataGrid/FilterOperator.cs
index a67922446e3f..0120581f840c 100644
--- a/src/MudBlazor/Components/DataGrid/FilterOperator.cs
+++ b/src/MudBlazor/Components/DataGrid/FilterOperator.cs
@@ -124,6 +124,16 @@ public static class Enum
             /// Find values which do not match the filter value.
             /// </summary>
             public const string IsNot = "is not";
+
+            /// <summary>
+            /// Find rows where the nullable enum column is <c>null</c>.
+            /// </summary>
+            public const string Empty = "is empty";
+
+            /// <summary>
+            /// Find rows where the nullable enum column is not <c>null</c>.
+            /// </summary>
+            public const string NotEmpty = "is not empty";
         }
 
         /// <summary>
@@ -286,6 +296,8 @@ internal static string[] GetOperatorByDataType(FieldType fieldType)
                 return new[] {
                     Enum.Is,
                     Enum.IsNot,
+                    Enum.Empty,
+                    Enum.NotEmpty,
                 };
             }
             if (fieldType.IsBoolean)


Test patch:
diff --git a/src/MudBlazor.UnitTests/Components/DataGridTests.cs b/src/MudBlazor.UnitTests/Components/DataGridTests.cs
index 0dcc4660d912..c87ae9d1b82c 100644
--- a/src/MudBlazor.UnitTests/Components/DataGridTests.cs
+++ b/src/MudBlazor.UnitTests/Components/DataGridTests.cs
@@ -2077,6 +2077,40 @@ public void FilterDefinitionEnum()
 
             #endregion
 
+            #region FilterOperator.Enum.Empty
+
+            filterDefinition = new FilterDefinition<DataGridFiltersTest.Model>
+            {
+                Column = statusColumn,
+                Operator = FilterOperator.Enum.Empty
+            };
+            func = filterDefinition.GenerateFilterFunction(new FilterOptions
+            {
+                FilterCaseSensitivity = dataGrid.Instance.FilterCaseSensitivity
+            });
+            func.Invoke(new("Sam", 456, Severity.Normal, null, null, null, null)).Should().BeFalse();
+            func.Invoke(new("Joe", 45, Severity.Info, null, null, null, null)).Should().BeFalse();
+            func.Invoke(new("Joe", 45, null, null, null, null, null)).Should().BeTrue();
+
+            #endregion
+
+            #region FilterOperator.Enum.NotEmpty
+
+            filterDefinition = new FilterDefinition<DataGridFiltersTest.Model>
+            {
+                Column = statusColumn,
+                Operator = FilterOperator.Enum.NotEmpty
+            };
+            func = filterDefinition.GenerateFilterFunction(new FilterOptions
+            {
+                FilterCaseSensitivity = dataGrid.Instance.FilterCaseSensitivity
+            });
+            func.Invoke(new("Sam", 456, Severity.Normal, null, null, null, null)).Should().BeTrue();
+            func.Invoke(new("Joe", 45, Severity.Info, null, null, null, null)).Should().BeTrue();
+            func.Invoke(new("Joe", 45, null, null, null, null, null)).Should().BeFalse();
+
+            #endregion
+
             // null operator
             filterDefinition = new FilterDefinition<DataGridFiltersTest.Model>
             {