We were using telerik version Kendo UI v2015.1.408 and recently upgraded to Kendo UI v2017.2.504 after which the server side pagination is not working fine. The sample code is as follows:
var allNameDataSource = new kendo.data.DataSource({
serverPaging: true,
serverFiltering: true,
transport: {
read: {
url: "/StudentNames/Name/GetAllNames",
contentType: "application/json; charset=utf-8",
dataType: "json",
async: false,
type: "POST"
},
parameterMap: function (options, operation) {
debugger;
if (operation !== "read" && options) {
return JSON.stringify({
model: options
});
}
else if (operation == "read") {
debugger;
var sortOrderField = null;
var sortOrderValue = null;
var selectedSorting = allNameViewModel.allNameDataSource.sort();
if (typeof (selectedSorting) != "undefined" && selectedSorting.length > 0) {
sortOrderField = selectedSorting[0].field;
sortOrderValue = selectedSorting[0].dir;
}
var filterAndCondition = allNameViewModel.allNameDataSource.filter();
if (typeof (filterAndCondition) != "undefined" && filterAndCondition != null) {
if (filterAndCondition.filters.length > 0) {
debugger;
allNameViewModel.pushKendoCustomFilter(filterAndCondition);
debugger;
var CustomFilters = allNameViewModel.Filters;
return JSON.stringify({ skip: options.skip, take: options.take, pageSize: options.pageSize, OrderByField: sortOrderField, OrderByValue: sortOrderValue, filter: allNameViewModel.filter, CustomFilters: CustomFilters });
}
}
return JSON.stringify({ skip: options.skip, take: options.take, pageSize: options.pageSize, OrderByField: sortOrderField, OrderByValue: sortOrderValue, filter: allNameViewModel.filter });
}
}
},
pageSize: PageCountValue > 0 ? PageCountValue: 10,
schema: {
model: {
id: "StudentId",
fields: {
Name: { type: 'string' },
Age: { type: 'string' },
Address: { type: 'string' },
Email: { type: 'string' }
}
},
data: function (data) {
return data.data;
},
total: function (data) {
return data.total;
},
}
}),
Please let me know what is wrong with this.