I use below code to invoke web api to get the data, but how to send pagesize, skip to web api.
$scope.consulationWorklist = {
dataSource:
new kendo.data.DataSource({
schema: {
data: "consultationItems",
total: "count"
},
serverPaging: true,
transport: {
read: function (options) {
$.ajax({
url: "http://localhost:61274/api/v1/consultation/search/result",
dataType: "json",
success: function (result) {
options.success(result);
},
error: function (result) {
options.error(result);
}
});
}
},
pageSize: 2,
}),
pageable: {
refresh: true,
//pageSizes: true,
buttonCount: 5,
input: true
},
scrollable: true,
filterable: true,
sortable: true,
columnMenu: true,
resizable: true,
};
ASP.NET WEB API CODE:
[HttpGet]
[Route("search/result")]
public IHttpActionResult SimpleSearch(int pageSize, int skip)
{
IEnumerable<ConsultationItemDto> result = _ConsultationService.GetAllConsultationItem();
return Ok(new WorklistSearchResultDto
{
Count = result.Count(),
ConsultationItems = result
});
}
There are many discussion said that the kendo will send the pageSize and skip when setting the serverpaging to true. But not works. any one can help ?
options
parameter of theread
function on your datasource. Pull them out and pass them to your json endpoint.