I am having issues getting endlessScroll to work to work with API. Maybe I am just not putting two and two together. I have seen options of converting IEnumerable to IQueryable OData, but that did not work either. Watching the Network trace, it appears that it is passing the correct parameters to the Web API controller.
The current issue is that when I scroll down, the endlessScroll does not get triggered for more records. It returns the pageSize specified but does not make another request to the Web API Get(). Please help! And thanks in advance for the assistance.
HERE IS MY INDEX.HTML PAGE SCRIPT. BELOW IS MY WEB API GET()
<
script
>
var dataSource;
function listViewInit(e) {
dataSource = new kendo.data.DataSource({
pageSize: 10,
page: 1,
serverPaging: true,
transport: {
read: {
url: "/api/Message/?isArchive=false",
dataType: "json",
type: 'GET'
}
},
parameterMap: function (options) {
var parameters = {
take: options.take,
skip: options.skip,
pageSize: options.pageSize,
page: options.page //next page
};
return parameters;
},
schema: {
data: function (data) {
return data.Data;
},
total: function (data) {
return data.Count;
}
}
});
e.view.element.find("#secure-inbox").kendoMobileListView({
endlessScroll: true,
dataSource: dataSource,
template: $("#listTemplate").text(),
scrollThreshold: 10
})
.kendoTouch({
filter: ">li",
enableSwipe: true,
touchstart: touchstart_inbox,
tap: navigate_inbox,
swipe: swipe_inbox
});
}
// Other Functions Removed For Forum Post //
</
script
>
// GET api/<
controller
>
public object Get(bool isArchived = false, int page = 1, int pageSize = 20)
{
IEnumerable<
Message
> data;
int count;
triagedbEntities db = new triagedbEntities();
db.Configuration.ProxyCreationEnabled = false;
data = (from x in db.view_secure_messages
where (x.TriageDecision != null) == isArchived
select new Message
{
msg_id = x.MessageID,
message_subject = x.MessageSubject,
message_received = x.MessageReceived
}).OrderByDescending(a => a.message_received).Skip((page - 1)*pageSize).Take(pageSize).ToList();
count = data.Count();
return new
{
Count = count,
Data = data
};
}