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

[Solved] How to prevent confirm box of command

3 Answers 540 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Huy
Top achievements
Rank 1
Huy asked on 04 Nov 2014, 02:39 AM
I have a kendo grid with command columns to delete row, and a button outside grid to delete multiple rows.

my problems: 

I want to disable confirm box of outside button but keep confirmbox of command column.

How to do it?

3 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 05 Nov 2014, 04:49 PM
Hi Huy,

I'm afraid that this is not possible. Although, the delete confirmation message can be disabled via the editable.confirmation option, this cannot be done on such basis as in your question. However, you may consider keeping the option enabled for the built-in command button, but use the DataSource API remove and sync methods for implementing the external button logic.

Regards,
Rosen
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Huy
Top achievements
Rank 1
answered on 06 Nov 2014, 01:26 AM
Hi Rosen,

This is my script to remove multiple rows:

$.each($('#grOrders :checkbox:checked').closest('tr'), function () {
               $('#grOrders').data().kendoGrid.removeRow($(this));
           })

But when each row removed, confirm box also appear.

Examble: i delete 5 rows at same time with code above, confirm box show 5 times, how to make it show only one?

Regards,
Huy
0
Rosen
Telerik team
answered on 07 Nov 2014, 09:26 AM
Hi Huy,

As I have stated in my previous message, in order to not show the confirmation message in your custom code you should use the DataSource API instead Grid's removeRow method. Similar to the following:

$("#delete-button").click(function() {
  var grid = $("#grOrders").getKendoGrid();
  var dataSource = grid.dataSource;
  
  $.each($('#grOrders :checkbox:checked').closest('tr'), function () {                       
    var dataItem = grid.dataItem($(this));
    dataSource.remove(dataItem); //marked record as deleted
  });
 
  dataSource.sync(); // push changes to the server
 
});


Regards,
Rosen
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
Huy
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Huy
Top achievements
Rank 1
Share this question
or