saveChanges

Fired when the user clicks the "save" command button.

The event handler function context (available via the this keyword) will be set to the widget instance.

Event Data

e.preventDefault Function

If invoked the grid will not call the sync method of the data source.

e.sender kendo.ui.Grid

The widget instance which fired the event.

Example - subscribe to the "saveChanges" event during initialization

<div id="grid"></div>
<script>
$("#grid").kendoGrid({
  columns: [
    { field: "name" },
    { field: "age" },
    { command: "destroy" }
  ],
  dataSource: {
    data:[
      { id: 1, name: "Jane Doe", age: 30},
      { id: 2, name: "John Doe", age: 33}
    ],
    schema: {
      model: { id: "id" }
    }
  },
  editable: true,
  saveChanges: function(e) {
    if (!confirm("Are you sure you want to save all changes?")) {
       e.preventDefault();
    }
  },
  toolbar: ["save"]
});
</script>

Example - subscribe to the "saveChanges" event after initialization

<div id="grid"></div>
<script>
  function grid_saveChanges(e) {
    if (!confirm("Are you sure you want to save all changes?")) {
      e.preventDefault();
    }
  }
  $("#grid").kendoGrid({
    columns: [
      { field: "name" },
      { field: "age" },
      { command: "destroy" }
    ],
    dataSource: {
      data:[
        { id: 1, name: "Jane Doe", age: 30},
        { id: 2, name: "John Doe", age: 33}
      ],
      schema: {
        model: { id: "id" }
      }
    },
    editable: true,
    toolbar: ["save"]
  });
  var grid = $("#grid").data("kendoGrid");
  grid.bind("saveChanges", grid_saveChanges);
</script>
In this article