Edit this page

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" });
console.log(dataSource.total()); // displays "0"
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" }
]);
console.log(dataSource.total()); // displays "0"
console.log(dataSource.hasChanges()); // displays "false"
</script>
Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy