I use virtualscroll to show a big list, this list is splitted by groups, but when i change group and add new value in array, virtualscroll reset with blank list.
I don’t know how can resolve this.
home.html
<ion-list [virtualScroll]="playlistFull" [hidden]="!groupView" approxItemHeight="'40px'" [virtualTrackBy]="trackBy">
<button ion-item *virtualItem="let channel" (click)="channelSelected(channel.link)"> // don't change items
<ion-img item-start [src]="channel.logo" width="30" height="30"></ion-img>
<h2>{{channel.title}}</h2>
</button>
</ion-list>
home.ts
updateList(group) {
this.groupView = group;
}
trackBy(index, channel) {
if(channel["group"] == this.groupView) { // Error this.groupView here is always undefined
return channel;
}
}