This question is locked. New answers and comments are not allowed.
I've got odata to work with a webapi call to a listview and I'm struggling with what appears to be a quirk in mvc.
If I return a pageresult from my webapi controller I just get the data as a json array i.e. no Count value.
To overcome this tiny issue I copy the Count value to the response header so I can pick it up in the client.
I can easily access the Count value in the transport complete event:
var datasource = new kendo.data.DataSource({
type: "odata",
transport: {
read: {
beforeSend: function (req) {
//req.setRequestHeader('Accept', 'application/json;odata=verbose');
},
url: "/api/products",
dataType: "json",
complete: function (jqXHR, textStatus) {
debugger;
count = jqXHR.getResponseHeader("Last-Count");
}
},
But this fires after the "Total" is processed so my Count is always one event behind.
How can I examine do something like count = jqXHR.getResponseHeader("Last-Count"); in the "Total" as I can't see where jqXHR is exposed in this part?
If I return a pageresult from my webapi controller I just get the data as a json array i.e. no Count value.
To overcome this tiny issue I copy the Count value to the response header so I can pick it up in the client.
I can easily access the Count value in the transport complete event:
var datasource = new kendo.data.DataSource({
type: "odata",
transport: {
read: {
beforeSend: function (req) {
//req.setRequestHeader('Accept', 'application/json;odata=verbose');
},
url: "/api/products",
dataType: "json",
complete: function (jqXHR, textStatus) {
debugger;
count = jqXHR.getResponseHeader("Last-Count");
}
},
But this fires after the "Total" is processed so my Count is always one event behind.
How can I examine do something like count = jqXHR.getResponseHeader("Last-Count"); in the "Total" as I can't see where jqXHR is exposed in this part?