Delete row using Keyboard

I've got a list of records and I want the user to be able to select a row and hit DEL to delete it, so I added this ...

<GridEditSettings AllowDeleting="true"></GridEditSettings>

That didn't work; if I hit DEL the UI looks like it has just selected the current cell.

I wondered if I needed to catch the event and do it manually, so I added ...

<GridEvents TValue="KeyListVm" OnActionBegin="OnGridAction"></GridEvents>

Now the page becomes unresponsive; not just the grid but the other controls on the page. This happens even if the method OnGridAction() is empty.

So, questions:

  1. Should I be able to delete a row using the keyboard? If so, how?
  2. Is there something I must do if I implement OnActionBegin() that allows the page to respond?



2 Replies

SH Stuart Hemming May 21, 2022 12:19 AM UTC

For giggles, I tried using OnActionComplete() instead, but that never even triggered when I hit DEL.

It might be worth noting that doing a sort on the grid with this handler defined meant that the handler was repeatedly and permanently invoked thereafter (I can see the "spinner" flashing on and off) although the page, and the grid itself carries on working 



RS Renjith Singh Rajendran Syncfusion Team May 23, 2022 06:12 AM UTC

Hi Stuart,


Greetings from Syncfusion support.


We checked this by creating a sample from our side. But we could not reproduce the reported problem. Deleting a row works fine from our side and Action events(OnActionBegin, OnActionComplete) also triggers fine when performing editing action. We are attaching the sample which we have tried for your reference.


Kindly download and refer the attached sample and check this from your side. If you are still facing difficulties then the following details would be helpful for us to proceed further.


  1. Share a simple issue reproducing sample for us to validate.
  2. Share the exact scenario you are reproducing this reported problem.
  3. Share the complete grid rendering codes and model class codes.


We suspect that you might have missed adding IsPrimaryKey for a unique valued column in Grid. So kindly ensure this case from your side.


References :

https://blazor.syncfusion.com/documentation/datagrid/editing

https://blazor.syncfusion.com/documentation/datagrid/editing#event-trace-while-editing


Query : Should I be able to delete a row using the keyboard? If so, how?

You can use the Delete key to delete a row using KeyBoard.


Query : doing a sort on the grid with this handler defined meant that the handler was repeatedly and permanently invoked

We have also added sorting in the attached sample and checked this case from our side. But we could not replicate the reported issue. Kindly refer the attached sample and check this from your side. If you are still facing difficulties then kindly share with us above requested details to proceed further.


Regards,

Renjith R


Attachment: ServerApp_b5a51546.zip

Loader.
Up arrow icon