Does anyone ever use collection repeat when working with huge lists? I like how the performance is improved but scrolling the list is always laggy on android; until we turn off the ionic scroll (overflow-scroll=“true”).
And, when that’s turned off; we can’t use collection repeat anymore It’s a trap
Should I stick with Collection repeat; so that my search filter works fine and less resources are spent on redrawing the DOM but scrolling my list will be laggy;
OR
I turn ionic’s scroll off, use the usual ‘ion-list’ and enjoy smooth scrolling on my android but experience lag when filtering through my list?
Hey there, so scrolling on android has been a constant battle.
So much so that we’ve actually be in the process of converting all of our scrolling components to be able to work with native scrolling. @perry’s been hard at work making things like PTR, Infinite Scroll, and Collection repeat to work without js scrolling.
This is a feature we intend to have in the next release.
So in short, we know its not perfect, we’re working on it, and we want to make it better
In my app I use Ionic scrolling with Collection-Repeat on iOS, and UI-Scroll (https://github.com/angular-ui/ui-utils/tree/master/modules/scroll) on Android. Combined with Crosswalk for Android for < 4.4.4, it works well and provides Infinite Scroll and Virtual Scrolling. The only things I lose on Android are PTR and a scroll bar.
I’d use UI-Scroll on both platforms just to keep things simple, but there’s a nasty iOS webkit bug where if you touch an item while the list is scrolling, the touch event will fire on the wrong item.
And then in the controller, there is code like this to implement uiScroller:
// start at revision 0, then increment every time we need to reload the UI Scroller.
var currentRevision = 0;
var revision = function() {
return currentRevision;
};
// *******************************************
// Functions for the Angular UI Scroller.
// Also used by Ionic Infinite Scroller.
$scope.uiScroller = {
reload: function() {
currentRevision++;
},
get: function(index, count, success) {
// make it zero-based instead of 1-based.
index--;
// If a negative, reset to start of list.
if (index < 0) {
count = count + index;
index = 0;
if (count <= 0) {
success([]);
$scope.loadingPosts = false;
return;
}
}
// your code
},
revision: function() {
// not required, but code is erroring without it.
return currentRevision;
},
loading: function(value) {
// Show a loading indicator if we have enough times.
if (value) {
LoadingService.show();
}
else {
LoadingService.hide();
}
}
};