Closed Lezeper closed 7 years ago
@Lezeper This behaviour could be provided via datasource.get code. Let's assume that the start data index is 0. Then we should restrict the result as follows:
var min = 0;
datasource.get = function (index, count, success) {
var result = [];
var start = Math.max(min, index);
var end = index + count - 1;
if (start <= end) {
for (var i = start; i <= end; i++) {
result.push("item #" + i);
}
}
success(result);
};
But if we are talking about remote data retrieving, something like
datasource.get = function (index, count, success) {
Server.request(index, count).then(function (result) {
success(result.items);
});
}
, then I would suggest to do it on Server side. If index < 0 then result.items length should be less then count (up to the empty array []).
The empty result will prevent scroll processing.
Issue solved.
How can I prevent datasource.get event be triggered when scroll up? I just want to load more data when scroll down..,
Thanks, Lewis