or
........
$.extend(
true
, kendo.data, {
schemas: {
odata: {
type:
"json"
,
data:
"d.results"
,
total:
"d.__count"
}
},
transports: {
odata: {
read: {
cache:
true
,
// to prevent jQuery from adding cache buster
dataType:
"jsonp"
,
jsonpCallback:
"callback"
,
//required by OData
jsonp:
false
// to prevent jQuery from adding the jsonpCallback in the query string - we will add it ourselves
},
.......
var
data =
new
kendo.data.DataSource({
type:
"odata"
,
transport: {
}
});
......
type:
"odata"
,
serverFiltering:
true
,
transport:{
read:
function
(options){
$.ajax({
//!!won't work when type is odata
url:
"http://my_test_url"
,
dataType:
"json"
,
data:options.data,
success:
function
(result) {
options.success(result);
doUserDefinedCallback();
//do my callback
}
});
}
}
......
.......
type:
"odata"
,
//using odata
serverFiltering:
true
,
transport: {
read: { //can NOT using $.ajax() manually here
url:
"http://my_test_url"
}
},
schema:{
data:
function
(response){
doServerCallFirst_Then_DoUserDefinedCallback();
//actually I do another server call here, then do my callback when the call returns.
return
response.d.results;
}
}
.......
//Initialize the result ListView with the selected template part
$(
"#searchResults"
).kendoMobileListView({
dataSource:
this
.getSearchData(),
template: templatePart,
endlessScroll:
true
,
scrollTreshold: 30
//treshold in pixels
});