Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 229600

virtualScroll scrollTo generates TypeError: Cannot read property 'scrollTop' of null

$
0
0

@mpicard
try this. might fix your problem.

@ViewChild(VirtualScroll) listView: VirtualScroll;

private scrollTo(index: number) {
let key = ‘#customIds_’ + index;

let hElement: HTMLElement = this.content._elementRef.nativeElement;
let element = hElement.querySelector(key);
element.scrollIntoView();

//wait till scroll animation completes
setTimeout(() => {
    //resize it! otherwise will not update the bufferRatio
    this.listView.resize();
},500);

}

setTimeout(() => {
this.scrollTo(‘someId’);
}, 1000);


Viewing all articles
Browse latest Browse all 229600

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>