pushUpdate

Updates the specified data items without marking them as "dirty". The data source will not sync data items appended via pushUpdate. If the data items are not found (using schema.model.id), they will be appended.

The difference between pushUpdate and updating items via their set method is that items updated via set are synced with the remote service.

Parameters

items Object|Array

The data item or data items to update.

Example - pushUpdate with a single item

<script>
var dataSource = new kendo.data.DataSource({
  schema: {
    model: {
      id: "id"
    }
  },
  data: [
     { id: 1, name: "John Doe" }
  ]
});
dataSource.read();
dataSource.pushUpdate({ id: 1, name: "Jane Doe" });
console.log(dataSource.at(0).name); // displays "Jane Doe"
console.log(dataSource.at(0).dirty); // displays "false"
console.log(dataSource.hasChanges()); // displays "false"
</script>

Example - pushUpdate 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.pushUpdate([
    { id: 1, name: "John" },
    { id: 2, name: "Jane" }
]);
console.log(dataSource.at(0).name); // displays "John"
console.log(dataSource.at(0).dirty); // displays "false"
console.log(dataSource.hasChanges()); // displays "false"
</script>
In this article
Not finding the help you need? Improve this article