Edit this page

sync

Fired after the data source saves data item changes. The data source saves the data item changes when the sync method is called.

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

The sync event is fired after all remote requests finish.

Event Data

e.sender kendo.data.DataSource

The data source instance which fired the event.

Example - subscribe to the sync event during initialization

<script>
var dataSource = new kendo.data.DataSource({
  batch: true,
  transport: {
    create: {
      url: "https://demos.telerik.com/kendo-ui/service/products/create",
      dataType: "jsonp" //"jsonp" is required for cross-domain requests; use "json" for same-domain requests
    },
    parameterMap: function(data) {
      return { models: kendo.stringify(data.models) };
    }
  },
  sync: function(e) {
    console.log("sync complete");
  },
  schema: {
    model: { id: "ProductID" }
  }
});
dataSource.add( { ProductName: "Ham" } );
dataSource.sync();
</script>

Example - subscribe to the sync event after initialization

<script>
function dataSource_sync(e) {
  console.log("sync complete");
}
var dataSource = new kendo.data.DataSource({
  batch: true,
  transport: {
    create: {
      url: "https://demos.telerik.com/kendo-ui/service/products/create",
      dataType: "jsonp" //"jsonp" is required for cross-domain requests; use "json" for same-domain requests
    },
    parameterMap: function(data) {
      return { models: kendo.stringify(data.models) };
    }
  },
  schema: {
    model: { id: "ProductID" }
  }
});
dataSource.bind("sync", dataSource_sync);
dataSource.add( { ProductName: "Ham" } );
dataSource.sync();
</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