Edit this page

requestEnd

Fired when a remote service request is finished.

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

The "response" argument is not available for local operations.

Event Data

e.response Object

The raw remote service response.

e.sender kendo.data.DataSource

The data source instance which fired the event.

e.type String

The type of the request.

Set to:

  • "create"
  • "read"
  • "update"
  • "destroy"

Example - subscribe to the "requestEnd" event during initialization

<script>
var dataSource = new kendo.data.DataSource({
  transport: {
    read: {
      url: "https://demos.telerik.com/kendo-ui/service/products",
      dataType: "jsonp"
    }
  },
  requestEnd: function(e) {
    var response = e.response;
    var type = e.type;
    console.log(type); // displays "read"
    console.log(response.length); // displays "77"
  }
});
dataSource.fetch();
</script>

Example - subscribe to the "requestEnd" event to catch only "read" requests

<script>
var dataSource = new kendo.data.DataSource({
  transport: {
    read: {
      url: "https://demos.telerik.com/kendo-ui/service/products",
      dataType: "jsonp"
    }
  },
  requestEnd: function(e) {
    //check the "response" argument to skip the local operations
    if (e.type === "read" && e.response) {
        console.log("Current request is 'read'.");
    }
  }
});
dataSource.fetch();
</script>

Example - subscribe to the "requestEnd" event after initialization

<script>
function dataSource_requestEnd(e) {
  var response = e.response;
  var type = e.type;
  console.log(type); // displays "read"
  console.log(response.length); // displays "77"
}
var dataSource = new kendo.data.DataSource({
  transport: {
    read: {
      url: "https://demos.telerik.com/kendo-ui/service/products",
      dataType: "jsonp"
    }
  }
});
dataSource.bind("requestEnd", dataSource_requestEnd);
dataSource.fetch();
</script>

The requestEvent does not hold information regarding any errors that occurred during the request. The error information is available as part of the error event.

Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy