Not able to delete a record , when i am press a delete key from keyboard

1 Answer 168 Views
Grid
Arun
Top achievements
Rank 1
Iron
Arun asked on 05 Aug 2021, 10:20 AM

When i select a row in a grid, and press a delete key in a keyboard, it is not deleting. onKeyDown  event is not triggering.

Please help me to resolve this issue.

 

Thanks.

Arun

Arun
Top achievements
Rank 1
Iron
commented on 06 Aug 2021, 10:04 AM

Great!!!, Thanks Stefan, after adding tab index and handled on keydown  event in div tag, it works fine.

But i have another issue like, when I am adding a new empty  row and try to delete  by using delete key, the event is not triggering, can you please  help me on this.

Stefan
Telerik team
commented on 06 Aug 2021, 11:00 AM

I made an example and the Delete keypress is fired as expected:

https://stackblitz.com/edit/react-9rfajj?file=app/main.tsx

If the issue still occurs, please share an example reproducing it and I will be happy to take a look.

Arun
Top achievements
Rank 1
Iron
commented on 13 Aug 2021, 08:06 AM

Thanks Stefan, it is working now

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 05 Aug 2021, 12:31 PM

Hello, Arun,

This occurs as the native onKeyDown event requires the element to have a tab index. The Grid has a tab index and will fire the event when the navigatable prop is true:

https://www.telerik.com/kendo-react-ui-develop/components/grid/api/GridProps/#toc-navigatable

If you do not want the navigation, you can add a DIV around the Grid, set a tab index to it, and attach the onKeyDown event to that DIV.

Regards,
Stefan
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Grid
Asked by
Arun
Top achievements
Rank 1
Iron
Answers by
Stefan
Telerik team
Share this question
or