pushDestroy

Removes the specified data items from the data source without marking them as "removed". The data source will not sync data items appended via pushDestroy.

The difference between pushDestroy and remove is that items removed via remove are synced with the remote service.

Parameters

items Object|Array

The data item or data items to remove from the data source.

Example - pushDestroy with a single item

<script>
var dataSource = new kendo.data.DataSource({
  schema: {
    model: {
      id: "id"
    }
  },
  data: [
     { id: 1, name: "John Doe" }
  ]
});
dataSource.read();
dataSource.pushDestroy({ id: 1, name: "John Doe" });
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(dataSource.total()); // displays "0"
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(dataSource.hasChanges()); // displays "false"
</script>

Example - pushDestroy with multiple items

<script>
var dataSource = new kendo.data.DataSource({
  schema: {
    model: {
      id: "id"
    }
  },
  data: [
     { id: 1, name: "John Doe" },
     { id: 2, name: "Jane Doe" }
  ]
});
dataSource.read();
dataSource.pushDestroy([
    { id: 1, name: "John Doe" },
    { id: 2, name: "Jane Doe" }
]);
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(dataSource.total()); // displays "0"
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(dataSource.hasChanges()); // displays "false"
</script>
In this article