cancel

Cancels changes in the currently edited item.

Example

<script type="text/x-kendo-tmpl" id="template">
 <div>
   <dl>
     <dt>Name</dt> <dd>#:name#</dd>
     <dt>Age</dt> <dd>#:age#</dd>
  </dl>
   <div>
       <a class="k-button k-edit-button" href="\\#"><span class="k-icon k-i-edit"></span></a>
  </div>
  </div>
</script>

<script type="text/x-kendo-tmpl" id="editTemplate">
 <div>
   <dl>
     <dt>Name</dt>
     <dd><input type="text" data-bind="value:name" name="name" required="required" /></dd>
     <dt>Age</dt>
     <dd><input type="text" data-bind="value:age" data-role="numerictextbox" data-type="number" name="age" required="required" /></dd>
  </dl>
   <div>
      <a class="k-button k-update-button" href="\\#">
        <span class="k-icon k-i-check"></span>
        </a>
  </div>
  </div>
</script>
<button class="k-button" id="cancelBtn">Cancel</button>
<div id="listView"></div>
<script>
  $("#listView").kendoListView({
    template: kendo.template($("#template").html()),
    editTemplate: kendo.template($("#editTemplate").html()),
    dataSource: {
      data: [
        { id: 1, name: "Jane Doe", age: 47 },
        { id: 2, name: "John Doe", age: 50 }
      ],
      schema: {
        model: {
          id: "id",
          fields: {
            id: { type: "number" },
            name: { type: "string" },
            age: { type: "number" }
          }
        }
      }
    }
  });
  $("#cancelBtn").click(function(){
    $("#listView").data("kendoListView").cancel();
  });
</script>
In this article