requestStart
Fired when the data source makes a remote service request.
The event handler function context (available via the this
keyword) will be set to the data source instance.
It is possible to prevent the remote request. To achieve this, execute e.preventDefault()
in the handler function.
This event can be prevented only for
read
requests.
Event Data
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 requestStart event during initialization
<script>
var dataSource = new kendo.data.DataSource({
transport: {
read: {
url: "https://demos.telerik.com/kendo-ui/service/products",
dataType: "jsonp"
}
},
requestStart: function(e) {
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log("request started");
}
});
dataSource.fetch();
</script>
Example - subscribe to the requestStart event after initialization
<script>
function dataSource_requestStart(e) {
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log("request started");
}
var dataSource = new kendo.data.DataSource({
transport: {
read: {
url: "https://demos.telerik.com/kendo-ui/service/products",
dataType: "jsonp"
}
}
});
dataSource.bind("requestStart", dataSource_requestStart);
dataSource.fetch();
</script>
Example - prevent the remote request
<script>
var dataSource = new kendo.data.DataSource({
transport: {
read: {
url: "https://demos.telerik.com/kendo-ui/service/products",
dataType: "jsonp"
}
},
requestStart: function(e) {
var myCondition = true;
if (myCondition) {
e.preventDefault();
}
}
});
dataSource.fetch();
</script>