Hi,
I need to remove the rows in radgrid on click of "Del" in keyboard. So I browsed the forum and got a solution to remove the radgrid rows from client side from this link
http://www.telerik.com/community/forums/aspnet-ajax/grid/delete-all-rows-in-a-radgrid-with-javascript.aspx#917286
So i got the below code
After selecting the rows and Del key clicked in keyboard the event is called correctly. But the value of get_selectedItems() is incrementing without the newly selected list of items. Lets say first time if I select 1 row then the value of masterTable.get_selectedItems().length is 1 then Del click removed the row. Next time when i selected 2 rows and checked the value of masterTable.get_selectedItems().length, it is 3.
Why the selected items length is incrementing without being refreshed to 0.
Is my approach correct?
I need to remove the rows in radgrid on click of "Del" in keyboard. So I browsed the forum and got a solution to remove the radgrid rows from client side from this link
http://www.telerik.com/community/forums/aspnet-ajax/grid/delete-all-rows-in-a-radgrid-with-javascript.aspx#917286
So i got the below code
function keyPress(sender, eventArgs) {
// Del button pressed
if (eventArgs.get_keyCode() == 127) {
var masterTable = sender.get_masterTableView();
for (i = 0; i < masterTable.get_selectedItems().length; i++) {
var it = masterTable.get_selectedItems()[i];
var element = it.get_element();
element.deleteRow(element.rowIndex);
}
}
After selecting the rows and Del key clicked in keyboard the event is called correctly. But the value of get_selectedItems() is incrementing without the newly selected list of items. Lets say first time if I select 1 row then the value of masterTable.get_selectedItems().length is 1 then Del click removed the row. Next time when i selected 2 rows and checked the value of masterTable.get_selectedItems().length, it is 3.
Why the selected items length is incrementing without being refreshed to 0.
Is my approach correct?