Hello,
I am experiencing an issue with the endless scroll when used with data pulled from the local database. When I scroll down the loading image appears at the bottom and it never disappears. Also, when I reach a point in the list and I scroll up there is almost a third of the screen that is not visible until I reach the top.
I tried it with data pulled from a server and works perfectly but not with data pulled from the local database. To me it looks like it does not know when the request is over so that it can hide the loading image.
This is the code I am using:
I am experiencing an issue with the endless scroll when used with data pulled from the local database. When I scroll down the loading image appears at the bottom and it never disappears. Also, when I reach a point in the list and I scroll up there is almost a third of the screen that is not visible until I reach the top.
I tried it with data pulled from a server and works perfectly but not with data pulled from the local database. To me it looks like it does not know when the request is over so that it can hide the loading image.
This is the code I am using:
var dataSource = new kendo.data.DataSource({
type: "json",
transport: {
read: function(options) {
db.transaction(queryRows, app.dbError);
function queryRows(tx) {
tx.executeSql("SELECT comps.*, (SELECT COUNT(*) FROM comps WHERE comps.comp_name LIKE ?) as total FROM comps WHERE comps.comp_name LIKE ? LIMIT ?, ?", ["%" + $("#search-comp-name").val() + "%", "%" + $("#search-comp-name").val() + "%", (options.data.page - 1) * 20, 20], queryRowsSuccess, queryRowsFailure);
}
function queryRowsSuccess(tx, results) {
var res = Array();
var total = 0;
for(var i = 0; i <
results.rows.length
; i++) {
res.push(results.rows.item(i));
}
if(results.rows.length > 0)
total = results.rows.item(0).total;
var resSchema = {
results: res, total: total
};
options.success(resSchema);
}
function queryRowsFailure(err) {
app.compListDbError();
}
}
},
schema: {
total: function (response) {
return response.total;
},
data: function(response) {
return response.results;
},
},
serverPaging: true,
pageSize: 20
});
$("#companyResultList").kendoMobileListView({
dataSource: dataSource,
template: $("#endless-scrolling-template").text(),
endlessScroll: true
});