Answer:
We can focus the excel dialog search text using OnActionComplete event handler. In the ActionComplete event, when RequestType is FilterAfterOpen, a JavaScript function is called to focus the text box. Refer the below code example.
<SfGrid @ref="Grid" DataSource="@Orders" AllowFiltering="true">
<GridEvents OnActionComplete="ActionCompleteHandler" TValue="Order">GridEvents>
<GridFilterSettings Type="Syncfusion.Blazor.Grids.FilterType.Excel">GridFilterSettings>
. . . . .
SfGrid>
@code{
SfGrid<Order> Grid { get; set; }
public List<Order> Orders
{ get; set; }
public void ActionCompleteHandler(ActionEventArgs<Order> Args)
{
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.FilterAfterOpen)
{
Runtime.InvokeVoidAsync("focus", Grid.ID);
}
}
function focus(id) { document.getElementById(id + "_SearchBox").focus();} |
Find the sample for set focus to the search box in Blazor DataGrid excel filter here.