From 4ce93dae6b1d49ea5217aeb192ab5c65863b9469 Mon Sep 17 00:00:00 2001 From: David Moreira Date: Mon, 16 Oct 2023 08:29:29 +0100 Subject: [PATCH] DataGrid: DataGridSelectColumn add missing select for validation (#5071) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * DataGrid | UseValidation | DataGridSelectColumn | Add missing select * Update Source/Extensions/Blazorise.DataGrid/_DataGridCell.razor --------- Co-authored-by: Mladen Macanović --- Source/Extensions/Blazorise.DataGrid/_DataGridCell.razor | 4 ++++ .../Blazorise.DataGrid/_DataGridCellSelectEdit.razor | 6 ++++++ .../Blazorise.DataGrid/_DataGridCellSelectEdit.razor.cs | 2 ++ 3 files changed, 12 insertions(+) diff --git a/Source/Extensions/Blazorise.DataGrid/_DataGridCell.razor b/Source/Extensions/Blazorise.DataGrid/_DataGridCell.razor index c3a0686319..bd02016ca3 100644 --- a/Source/Extensions/Blazorise.DataGrid/_DataGridCell.razor +++ b/Source/Extensions/Blazorise.DataGrid/_DataGridCell.razor @@ -20,6 +20,10 @@ else { <_DataGridCellEditValidation Column="@Column" Item="@Item" ValidationItem="@ValidationItem" Field="@Column.Field" ValueType="@valueType" CellEditContext="CellEditContext" Readonly="@Column.Readonly" CellValueChanged="@CellValueChanged" ShowValidationFeedback="@ShowValidationFeedback" ValidationPattern="@ValidationPattern" DateInputMode="@dateColumn.InputMode" /> } + else if ( Column is DataGridSelectColumn selectColumn ) + { + <_DataGridCellSelectEdit Column="@selectColumn" CellValue="CellEditContext.CellValue" CellValueChanged="@OnEditValueChanged" ShowValidationFeedback="@ShowValidationFeedback" /> + } else { <_DataGridCellEditValidation Column="@Column" Item="@Item" ValidationItem="@ValidationItem" Field="@Column.Field" ValueType="@valueType" CellEditContext="CellEditContext" Readonly="@Column.Readonly" CellValueChanged="@CellValueChanged" ShowValidationFeedback="@ShowValidationFeedback" ValidationPattern="@ValidationPattern" /> diff --git a/Source/Extensions/Blazorise.DataGrid/_DataGridCellSelectEdit.razor b/Source/Extensions/Blazorise.DataGrid/_DataGridCellSelectEdit.razor index b3e010f6fa..a7ec340faa 100644 --- a/Source/Extensions/Blazorise.DataGrid/_DataGridCellSelectEdit.razor +++ b/Source/Extensions/Blazorise.DataGrid/_DataGridCellSelectEdit.razor @@ -15,6 +15,12 @@ } } + + @if ( ShowValidationFeedback ) + { + + } + @code { protected RenderFragment itemFragment => item => __builder => diff --git a/Source/Extensions/Blazorise.DataGrid/_DataGridCellSelectEdit.razor.cs b/Source/Extensions/Blazorise.DataGrid/_DataGridCellSelectEdit.razor.cs index 33d92b2f38..1a824a0c08 100644 --- a/Source/Extensions/Blazorise.DataGrid/_DataGridCellSelectEdit.razor.cs +++ b/Source/Extensions/Blazorise.DataGrid/_DataGridCellSelectEdit.razor.cs @@ -24,4 +24,6 @@ public partial class _DataGridCellSelectEdit : ComponentBase /// Raises when cell value changes. /// [Parameter] public EventCallback CellValueChanged { get; set; } + + [Parameter] public bool ShowValidationFeedback { get; set; } } \ No newline at end of file