Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Do I Prevent the KendoGrid's RemoveRow Function from Prompting?

I'm using a Kendo Grid's removeRow function. It works, but it always prompts "Are you sure you want to delete this record?" whenever I programmatically remove a row. I've already done the decision-making as to whether or not the row should be removed, so I don't want this message to show up. Googling didn't help and I couldn't find any similar question on StackOverflow or Kendo's forum. I know I could change the code, but I was wondering if there's a way to configure the grid to just not show it? Another solution would maybe be to temporarily block confirm prompts, possibly? Not sure if that's possible.

like image 567
vbullinger Avatar asked Oct 10 '12 17:10

vbullinger


2 Answers

Setting editable.confirmation to false should do the trick:

kendoGrid( {
  editable: {
      confirmation: false
  }
})
like image 161
Atanas Korchev Avatar answered Oct 01 '22 12:10

Atanas Korchev


I have a workaround that I just figured out, in the meantime. It works fine, but it's a bit hacky:

var oldConfirm = window.confirm;
window.confirm = function() { return true; };
grid.getKendoGrid().removeRow(selectedRow);
window.confirm = oldConfirm;

I'd still be interested in hearing about any disabling of the confirmation, however, and I'll accept that as the answer if it comes along.

like image 39
vbullinger Avatar answered Oct 01 '22 12:10

vbullinger