I fetch data from the server using like so (the fetch url has been predefined using jQuery.ajaxSetup()):
After I execute read() the DataSource contains data, and the objects look OK.
Example:
But executing the method total() returns 0 and get(index) always returns undefined.
What am I doing wrong?
var
dataSourceStatistics =
new
kendo.data.DataSource({
transport: {
read: {
data: {
f:
'getCustomerStats'
,
fromDate:
function
() {
return
kendo.toString(kendo.parseDate(calendarstart.value()),
"yyyy-MM-dd"
)
},
toDate:
function
() {
return
kendo.toString(kendo.parseDate(calendarend.value()),
"yyyy-MM-dd"
)
},
custStats:
null
}
}
},
schema: {
data:
function
(data) {
return
data.result.custStats.Record;
},
model:{
id:
"Employee"
,
fields: {
Employee:
"Employee"
,
Value:
"Value"
,
ValueUsed:
"ValueUsed"
,
ValueLeft:
"ValueLeft"
}
}
},
pageSize: 10
});
After I execute read() the DataSource contains data, and the objects look OK.
Example:
[{
"Employee"
:
"John Doe"
,
"ValueUsed"
:
"50"
,
"ValueLeft"
:
"0"
}]
But executing the method total() returns 0 and get(index) always returns undefined.
What am I doing wrong?