I'm working on a mvc project which retrieve data from server and present to client via Kendo UI Grid & OData & Web API. I would like to use virtual scrolling to implement server paging, and I followed the demo virtualization-remote-data, but it did not work for me, here is my client code:
<script>
$(document).ready(function () {
var webApiUrl = gms.App.getApiBaseUrl() + "odata/Containers";
$("#grid").kendoGrid({
dataSource: {
type: "odata",
serverPaging: true,
serverSorting: true,
pageSize: 50,
schema: {
data: function (data) {
if (data.value) {
return data.value;
}
delete data["odata.metadata"];
return [data];
},
total: function (data) {
return data["odata.count"];
}
},
transport: {
read: { url: webApiUrl, dataType: "json" },
parameterMap: function (options, type) {
// this is optional - if we need to remove any
// parameters (due to partial OData support in WebAPI
var parameterMap = kendo.data.transports.odata.parameterMap(options);
delete parameterMap.$inlinecount; // remove inlinecount parameter
delete parameterMap.$format; // remove format parameter
return parameterMap;
}
}
},
//filterable: {mode:"row"},
//columnMenu: true,
selectable: "single",
//reorderable: true,
sortable: true,
height: 640,
scrollable: { virtual: true },
sortable: true,
columns: [
{ field: "ContainerId", title: "Container Id" },
{ field: "UtcDt", title: "Utc Date" },
{ field: "TempSetpoint", title: "Temperature °C" },
{ field: "SupplyTemp", title: "Supply °C" },
{ field: "Usda1", title: "Usda1 °C" },
{ field: "Usda2", title: "Usda2 °C" }
],
});
});
</script>
There was no scrolling bar display when I set the configuration of grid as the code present.
<script>
$(document).ready(function () {
var webApiUrl = gms.App.getApiBaseUrl() + "odata/Containers";
$("#grid").kendoGrid({
dataSource: {
type: "odata",
serverPaging: true,
serverSorting: true,
pageSize: 50,
schema: {
data: function (data) {
if (data.value) {
return data.value;
}
delete data["odata.metadata"];
return [data];
},
total: function (data) {
return data["odata.count"];
}
},
transport: {
read: { url: webApiUrl, dataType: "json" },
parameterMap: function (options, type) {
// this is optional - if we need to remove any
// parameters (due to partial OData support in WebAPI
var parameterMap = kendo.data.transports.odata.parameterMap(options);
delete parameterMap.$inlinecount; // remove inlinecount parameter
delete parameterMap.$format; // remove format parameter
return parameterMap;
}
}
},
//filterable: {mode:"row"},
//columnMenu: true,
selectable: "single",
//reorderable: true,
sortable: true,
height: 640,
scrollable: { virtual: true },
sortable: true,
columns: [
{ field: "ContainerId", title: "Container Id" },
{ field: "UtcDt", title: "Utc Date" },
{ field: "TempSetpoint", title: "Temperature °C" },
{ field: "SupplyTemp", title: "Supply °C" },
{ field: "Usda1", title: "Usda1 °C" },
{ field: "Usda2", title: "Usda2 °C" }
],
});
});
</script>
There was no scrolling bar display when I set the configuration of grid as the code present.