Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DataGrid] Trigger OnRowClick on keyboard enter in DataGrid row #2577

Merged
merged 2 commits into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3345,7 +3345,7 @@
</member>
<member name="P:Microsoft.FluentUI.AspNetCore.Components.DialogParameters.Visible">
<summary>
Gets or sets if a dialog is visible or nt (Hidden)
Gets or sets if a dialog is visible or not (Hidden)
</summary>
</member>
<member name="P:Microsoft.FluentUI.AspNetCore.Components.DialogParameters.PreventScroll">
Expand Down Expand Up @@ -3406,7 +3406,7 @@
<summary>
Gets or sets the height of the dialog. Must be a valid CSS height value like "600px" or "3em"
Only used if Alignment is set to "HorizontalAlignment.Center"
</summary>
</summary>
</member>
<member name="P:Microsoft.FluentUI.AspNetCore.Components.DialogParameters.DialogBodyStyle">
<summary>
Expand Down Expand Up @@ -3440,7 +3440,7 @@
</member>
<member name="P:Microsoft.FluentUI.AspNetCore.Components.DialogParameters.ShowSecondaryAction">
<summary>
Gets whether the secondary button is displayed or not. Depends on SecondaryAction having a value.
Gets whether the secondary button is displayed or not. Depends on SecondaryAction having a value.
</summary>
</member>
<member name="P:Microsoft.FluentUI.AspNetCore.Components.DialogParameters.OnDialogResult">
Expand Down
10 changes: 8 additions & 2 deletions src/Core/Components/DataGrid/FluentDataGridRow.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,14 @@ internal async Task HandleOnRowKeyDownAsync(string rowId, KeyboardEventArgs e)
return;
}

var row = GetRow(rowId, r => r.RowType == DataGridRowType.Default);
if (row != null)
var row = GetRow(rowId);

if (row != null && Owner.Grid.OnRowClick.HasDelegate)
{
await Owner.Grid.OnRowClick.InvokeAsync(row);
}

if (row != null && row.RowType == DataGridRowType.Default)
{
foreach (var column in Owner.Grid._columns)
{
Expand Down
Loading