I'm using kendo pager with kendo list view. kendo pager works fine when pagination is done at client side. When Server pagination is enabled at dataSource, and set the data/total in schema, kendo pager doesn't work. (It just displays "No Items to display").
When I replace the kendo list view with kendo grid using the same dataSource and options (specified in the controller), the pagination (not the kendo pager) which comes along with the grid works well(able to see the total count).
Need to make kendo-pager work with kendo list view. (Note: Here, "Total" returns from WebApi controller, and I'm able to see correct total inside the total function). please find below the sample dataSource and list view & pager options. Let me know if I'm missing something.
vm.dataSource = {
serverPaging: true,
serverSorting: true,
type:"json",
pageSize: 10,
transport: {
read:
{
url: "api/testsapi/GetResult",
type: "GET",
dataType: "json",
data: {},
processData: true,
cache:true
},
},
schema:
{
type : "json",
total: function (e) {
return e.Total;
},
data: "WorklistItems"
},
};
vm.patientListOptions = {
template: kendo.template($('#patientSearchTemplate').html()),
dataSource : vm.dataSource,
//height: 500,
pageSize : 10,
pageable :true
};
vm.pagerOptions = {
dataSource: vm.dataSource,
numeric : false
};
<div k-options="vm.pagerOptions" kendo-pager="pager">
</div>
<div kendo-list-view="listView" k-options="vm.patientListOptions>
</div>
Issue is fixed..mistake in my code: When I Initialize the datasource vm.dataSource = new kendo.data.DataSource, Pager works correctly.