For my Kendo Datasource resulting json has a column "TotalRecords" how can i set this total to Kendo Datasource total so that my Server paging can work. My code is as below:
var iDataSource = new kendo.data.DataSource({
transport: {
read:
{
url: service_URL + "GetUnconfirmedppointments",
datatype: "json",
type: "GET"
},
parameterMap: function (options) {
return {
appointmentNos: Appointment_Number.value,
loadNumbers: Load_Number.value,
purchaseOrders: Purchase_Orders.value,
dateFrom: Date_From.value,
dateTo: Date_To.value,
warehouse: warehouses.value,
carrierId: cr_carrier_id,
sortColum: getOrderBy(options.sort),
sortDirection: getOrderDir(options.sort),
pageSize: options.pageSize,
pageNumber: options.page
};
}
},
schema: {
model: {
fields: {
APP_APPOINTMENT_ID: { type: "number" },
APPOINTMENT_DATE: { type: "date" },
LO_LOAD_NUMBER: { type: "number" }
}
}
},
pageSize: 5,
total: function (response) {
return response[0].TotalRecords;
},
serverPaging: true,
serverFiltering: true,
serverSorting: true
});
Current implementation doesn't work, even if i provided hardcoded total record number, when this datasource is binded to grid the total count only shows the number of records returned in the json which is pagesize.
totaloutsideschemainstead of inside. See Burke Holland answer for more details. - OnaBai