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

Delete confirmation is shown although it is deactivated

2 Answers 110 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mathias
Top achievements
Rank 1
Mathias asked on 27 Sep 2012, 01:40 PM
Hello,

I think I found a new bug. We deactivated the delete confirmation with the DisplayDeleteConfirmation-property. Works perfectly for the delete-button in the grid. Only problem: When I delete a row manually the confirmation is still shown.

Here my code:
function myFunction()
{
var gridChoosenValues = $('#MyGrid').data("kendoGrid");
var choosenItems = gridChoosenValues.items();
for (var i = 0; i < choosenItems.length; i++) //delete every row
{
grid.removeRow(choosenItems[i]); //this triggers delete confirmation :(
}
}


hope this will be fixed soon. And a method for deleting all rows of a grid would also be very nice :)

Best regards,
Mathias

2 Answers, 1 is accepted

Sort by
0
Mathias
Top achievements
Rank 1
answered on 28 Sep 2012, 08:05 AM
k... in addition to the confirmation problem the rows doesn't get deleted! They're just getting a style "display:none" -.- So what can I do? Am I using the wrong function?


EDIT: Found the solution: I have to delete the row directly in the DataSource
var dataItem = grid.dataItem(choosenItems[i]);
grid.dataSource.remove(dataItem);

But this doesn't work if i have more than one Item i wanna delete :/

0
Mathias
Top achievements
Rank 1
answered on 28 Sep 2012, 08:48 AM

Finally I got my solution for deleting all rows of the grid:

function deleteAllGridRows()
{
var grid = $('#MyGrid').data('kendoGrid');
var items = grid.items();
for (var i = 0; i < items.length; ) //delete every row
{
var dataItem = grid.dataItem(items[i]);
grid.dataSource.remove(dataItem);
grid.refresh();
items = grid.items();
}
}

This works perfectly in my case.

Tags
Grid
Asked by
Mathias
Top achievements
Rank 1
Answers by
Mathias
Top achievements
Rank 1
Share this question
or