Skip to content

Commit

Permalink
DataGrid: DataGridSelectColumn add missing select for validation (#5071)
Browse files Browse the repository at this point in the history
* DataGrid | UseValidation | DataGridSelectColumn | Add missing select

* Update Source/Extensions/Blazorise.DataGrid/_DataGridCell.razor

---------

Co-authored-by: Mladen Macanović <[email protected]>
  • Loading branch information
David-Moreira and stsrki authored Oct 16, 2023
1 parent 7a5bd3f commit 4ce93da
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Source/Extensions/Blazorise.DataGrid/_DataGridCell.razor
Original file line number Diff line number Diff line change
Expand Up @@ -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<TItem> 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" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
}
}
</ChildContent>
<Feedback>
@if ( ShowValidationFeedback )
{
<ValidationError />
}
</Feedback>
</Select>
@code {
protected RenderFragment<object> itemFragment => item => __builder =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ public partial class _DataGridCellSelectEdit<TItem> : ComponentBase
/// Raises when cell value changes.
/// </summary>
[Parameter] public EventCallback<object> CellValueChanged { get; set; }

[Parameter] public bool ShowValidationFeedback { get; set; }
}

0 comments on commit 4ce93da

Please sign in to comment.