From 9bbe34deceea6e718022a48f124fad18959bd245 Mon Sep 17 00:00:00 2001 From: OlgunR Date: Thu, 5 Feb 2026 11:37:06 +0100 Subject: [PATCH] Enhance grid filter UI with custom editors for each type Replaced default filter row editors with custom templates in CatalogsGrid and MassDataGrid. Added DxTextBox for text fields, DxDateEdit for date fields, and a DxComboBox for boolean status filtering. Introduced BoolFilterOption class to support the status dropdown. These changes improve filter usability and data type handling. --- .../Components/CatalogsGrid.razor | 56 ++++++++++++++++--- .../Components/MassDataGrid.razor | 36 +++++++++--- .../Components/CatalogsGrid.razor | 56 ++++++++++++++++--- .../Components/MassDataGrid.razor | 36 +++++++++--- 4 files changed, 152 insertions(+), 32 deletions(-) diff --git a/DbFirst.BlazorWasm/Components/CatalogsGrid.razor b/DbFirst.BlazorWasm/Components/CatalogsGrid.razor index 25b9a0a..42973ee 100644 --- a/DbFirst.BlazorWasm/Components/CatalogsGrid.razor +++ b/DbFirst.BlazorWasm/Components/CatalogsGrid.razor @@ -83,13 +83,55 @@ else DataItemDeleting="OnDataItemDeleting"> - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @{ SetEditContext(editFormContext.EditContext); var editModel = (CatalogEditModel)editFormContext.EditModel; } diff --git a/DbFirst.BlazorWasm/Components/MassDataGrid.razor b/DbFirst.BlazorWasm/Components/MassDataGrid.razor index b4f5524..a0fba53 100644 --- a/DbFirst.BlazorWasm/Components/MassDataGrid.razor +++ b/DbFirst.BlazorWasm/Components/MassDataGrid.razor @@ -116,23 +116,28 @@ else - + - + - + @@ -169,6 +174,13 @@ else private int pageIndex; private int pageCount = 1; + private readonly List statusFilterOptions = new() + { + new() { Value = null, Text = "Alle" }, + new() { Value = true, Text = "True" }, + new() { Value = false, Text = "False" } + }; + protected override async Task OnInitializedAsync() { await LoadPage(0); @@ -237,4 +249,10 @@ else e.Cancel = true; return Task.CompletedTask; } + + private sealed class BoolFilterOption + { + public bool? Value { get; set; } + public string Text { get; set; } = string.Empty; + } } diff --git a/DbFirst.BlazorWebApp/Components/CatalogsGrid.razor b/DbFirst.BlazorWebApp/Components/CatalogsGrid.razor index e59fd81..322c3b5 100644 --- a/DbFirst.BlazorWebApp/Components/CatalogsGrid.razor +++ b/DbFirst.BlazorWebApp/Components/CatalogsGrid.razor @@ -42,13 +42,55 @@ else DataItemDeleting="OnDataItemDeleting"> - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @{ SetEditContext(editFormContext.EditContext); var editModel = (CatalogEditModel)editFormContext.EditModel; } diff --git a/DbFirst.BlazorWebApp/Components/MassDataGrid.razor b/DbFirst.BlazorWebApp/Components/MassDataGrid.razor index b4f5524..a0fba53 100644 --- a/DbFirst.BlazorWebApp/Components/MassDataGrid.razor +++ b/DbFirst.BlazorWebApp/Components/MassDataGrid.razor @@ -116,23 +116,28 @@ else - + - + - + @@ -169,6 +174,13 @@ else private int pageIndex; private int pageCount = 1; + private readonly List statusFilterOptions = new() + { + new() { Value = null, Text = "Alle" }, + new() { Value = true, Text = "True" }, + new() { Value = false, Text = "False" } + }; + protected override async Task OnInitializedAsync() { await LoadPage(0); @@ -237,4 +249,10 @@ else e.Cancel = true; return Task.CompletedTask; } + + private sealed class BoolFilterOption + { + public bool? Value { get; set; } + public string Text { get; set; } = string.Empty; + } }