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

Set cancel option on a grid that has already been initialized

2 Answers 63 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tyler
Top achievements
Rank 1
Tyler asked on 10 Oct 2013, 05:48 PM
Is there a way to set the cancel option on a grid that has already been initialized?

I'm using the serverside MVC wrapper and have this:
.Events(events => events.Cancel("function() {alert('hi');}"))

Clientside I tried:
$("#grdTest").kendoGrid({ cancel: function () { alert("canceled"); } });
and
$kendoGrid = $("#grdTest").data("kendoGrid");
$kendoGrid.options.cancel = function () {
alert('Canceled');
};

2 Answers, 1 is accepted

Sort by
0
Accepted
Alexander Valchev
Telerik team
answered on 11 Oct 2013, 07:12 AM
Hi Tyler,

If I understood correctly, you would like to bind to the cancel event after Kendo Grid is initialized.
This is supported, in order to achieve it you should use bind method of the widget.
$(document).ready(function() {
  var grid = $("#gridName").data("kendoGrid");
  grid.bind("cancel", grid_cancel);
});
 
function grid_cancel(e) {
  //handle event
}

The code should be placed and executed after the server side MVC code that you use to initialize the Grid.
I hope this information will help.

Regards,
Alexander Valchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Tyler
Top achievements
Rank 1
answered on 11 Oct 2013, 04:45 PM



Tags
Grid
Asked by
Tyler
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Tyler
Top achievements
Rank 1
Share this question
or