Hi Jeremy,
Thanks for contacting Syncfusion support.
Query: “Can you please either adding FocusIn / FocusOut to the data grid, as I feel that I should be able to set focus to any data entry control.”
We have analyzed your query and we understand that you want to focus the Grid on user interaction. Grid can be focused using Alt + J key combination. Currently we are facing some issues with that combination. Hence we are not able to focus the grid. We have confirmed it is a bug and logged the defect report for the same “Not able to focus the Grid”. Thank you for taking the time to report this issue and helping us improve our product .Fix for the issue will be included in our weekly patch release which is expected to be rolled by mid of October 2020.
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.
Till then we suggest you to use the below workaround to resolve the reported query. We have used Created event of the grid to store the Grid Id in JavaScript method. And we have added keydown event to document page. We have focused the grid element using focus() JavaScript method. So kindly use the Alt + J key combination to focus the Grid.
|
<SfGrid @ref="Grid" DataSource="@Orders" AllowPaging="true">
<GridEvents Created="Created" TValue="Order"></GridEvents>
<GridPageSettings PageSize="5"></GridPageSettings>
. . . . . . .
</SfGrid>
@code{
public List<Order> Orders { get; set; }
SfGrid<Order> Grid { get; set; }
public void Created()
{
RunTime.InvokeVoidAsync("Focus", Grid.ID);
}
[Focus.js]
var gridElement; function Focus(id) { gridElement = id;} document.addEventListener("keydown", function (e) { if (e.altKey && e.keyCode === 74) { // j- key code. if (gridElement !== null) document.getElementById(gridElement).focus(); }});
|
For your convenience we have prepared a sample which can be downloaded from below
Please get back to us if you have further queries.
Regards,
Vignesh Natarajan