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;
/* The result can be observed in the DevTools(F12) console of the browser. */
    console.log(type); // displays "read"
/* The result can be observed in the DevTools(F12) console of the browser. */
    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) {
/* The result can be observed in the DevTools(F12) console of the browser. */
        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;
/* The result can be observed in the DevTools(F12) console of the browser. */
  console.log(type); // displays "read"
/* The result can be observed in the DevTools(F12) console of the browser. */
  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 requestEnd event does not hold information regarding any errors that occurred during the request. The error information is available as part of the error event.

In this article