This is a migrated thread and some comments may be shown as answers.

grid row delete by using keyboard delete key

1 Answer 219 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Siva Prasad
Top achievements
Rank 1
Siva Prasad asked on 22 May 2014, 04:57 AM
Hi Team,

Could you please help us to delete a selected row in a grid by using keyboard delete key.

Thanks
Siva

1 Answer, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 22 May 2014, 07:24 AM
Hello Siva,


To achieve this you could bind to the keydown event of the delete button, retrieve the currently selected row with the select method of the Grid API and remove it with the removeRow method.
E.g.
$(function () {
    var grid = $("#grid").data("kendoGrid");
    grid.table.on("keydown", function (e) {
        if (e.keyCode == 46) {
            grid.removeRow(grid.select());
        }
    })
});

I hope this information helps.

Regards,
Dimiter Madjarov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Siva Prasad
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Share this question
or