Skip to content

Commit

Permalink
DropDownDataGrid OpenOnFocus logic fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
enchev committed Sep 6, 2024
1 parent 56cb173 commit aa7306e
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions Radzen.Blazor/RadzenDropDownDataGrid.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -719,10 +719,7 @@ protected override async Task HandleKeyPress(KeyboardEventArgs args, bool isFilt
}
}

if (!Multiple)
{
await JSRuntime.InvokeVoidAsync("Radzen.closePopup", PopupID);
}
await CloseAndFocus();
}
}
else if (args.AltKey && key == "ArrowDown")
Expand Down Expand Up @@ -891,19 +888,28 @@ protected override async Task OnFilter(ChangeEventArgs args)
public bool AllowRowSelectOnRowClick { get; set; } = true;

async Task OnRowSelect(object item)
{
await CloseAndFocus();

if (AllowRowSelectOnRowClick)
{
await SelectItem(item);
}
}

async Task CloseAndFocus()
{
if (!Disabled && !Multiple)
{
await JSRuntime.InvokeVoidAsync("Radzen.closePopup", PopupID);
}

await JSRuntime.InvokeVoidAsync("Radzen.focusElement", UniqueID);
var of = OpenOnFocus;
OpenOnFocus = false;

if (AllowRowSelectOnRowClick)
{
await SelectItem(item);
}
await JSRuntime.InvokeVoidAsync("Radzen.focusElement", UniqueID);

OpenOnFocus = of;
}

private async Task OnChipRemove(object item)
Expand Down

0 comments on commit aa7306e

Please sign in to comment.