I got Sorting and filtering working with WebAPI.
I am not able to get paging to work.
Not matter what value i use(i have tried litral values like 10) the grid always display 0 pages ().
What could i be doing wrong
I am not able to get paging to work.
Not matter what value i use(i have tried litral values like 10) the grid always display 0 pages ().
What could i be doing wrong
$(document).ready(
function
() {
$(
"#grid"
).kendoGrid({
dataSource: {
type:
'odata'
,
transport: {
read: {
url:
"http://localhost:13059/api/Addressbook"
,
contentType:
"application/json; charset=utf-8"
,
dataType:
"json"
,
type:
"GET"
,
data: {}
},
parameterMap:
function
(options, type) {
var
paramMap = kendo.data.transports.odata.parameterMap(options);
delete
paramMap.$inlinecount;
// <-- remove inlinecount parameter.
delete
paramMap.$format;
// <-- remove format parameter.
//paramMap.$includeTotalCount= "True";
return
paramMap;
}
},
success:
function
(e) {
alert(
"Success: "
+ e.error);
},
error:
function
(e) {
debugger;
alert(
"Error: "
+ e.errorThrown);
},
change:
function
(e) {
// alert("Change");
},
requestStart:
function
(e) {
//alert("Request Start");
},
schema: {
data:
function
(data) {
return
data.Results;
// <-- The result is just the data, it doesn't need to be unpacked.
},
total:
function
(data) {
// return data.length; // <-- The total items count is the data length, there is no .Count to unpack.
return
data.TotalResults;
},
model: {
fields: {
Country_Code: { type:
"string"
},
Country_ID: { type:
"number"
},
Country_Name: { type:
"string"
},
County_Desc: { type:
"string"
}
}
}
},
pageSize: 1,
//serverPaging: true,
// serverFiltering: true,
// serverSorting: true
},
height: 250,
filterable:
true
,
sortable:
true
,
pageable:
true
});
});