Hi,
I've some problems to make the endless scroll work with a local sql lite db (edit: in fact it's not sql lite, but web sql, but at the end the problem is the same ;-)).
The first 10 items are well loaded, but the "read: " function is not called when I scroll down to the last item of the view. I think I'm missing something...
I don't think I need the transport->parameterMap nor the datasource->schema, but maybe I'm wrong.
Thanks for your help!
Here is my view:
I've some problems to make the endless scroll work with a local sql lite db (edit: in fact it's not sql lite, but web sql, but at the end the problem is the same ;-)).
The first 10 items are well loaded, but the "read: " function is not called when I scroll down to the last item of the view. I think I'm missing something...
I don't think I need the transport->parameterMap nor the datasource->schema, but maybe I'm wrong.
Thanks for your help!
Here is my view:
<!DOCTYPE html>
<html>
<head>
<title>Activities</title>
</head>
<body>
<div data-role=
"view"
data-layout=
"default"
data-init=
"initTask"
>
<h1>Tasks</h1>
<ul id=
"tasks"
></ul>
</div>
<script>
var
ds =
new
kendo.data.DataSource({
pageSize: 10,
serverPaging:
true
,
transport: {
read:
function
(options) {
writeLog(
'DataSource READ'
);
_db.transaction(
function
(tx) {
writeLog(
'Reading from DB'
);
var
sql =
'SELECT name, date FROM testtable LIMIT '
+ options.data.pageSize * (options.data.page - 1) +
','
+ options.data.pageSize;
tx.executeSql(sql, [],
function
(tx, results) {
writeLog(
'Results found: '
+ results.rows.length);
var
data = [];
for
(
var
i=0; i<results.rows.length; i++) {
data[i] = results.rows.item(i);
}
options.success(data);
});
}, transaction_error);
}
}
});
function
initTask() {
writeLog(
'init'
);
$(
"#tasks"
).kendoMobileListView({
dataSource: ds,
template: kendo.template($(
"#tmpl-post"
).html(), {useWithBlock:
true
}),
endlessScroll:
true
,
scrollTreshold: 30
//treshold in pixels
});
}
</script>
</body>
</html>