Is it possible to detect a scroll event from inside a p-dialog?
I am using the following code :
Code: Select all
<p-dialog [contentStyle]="{'max-height':'600px', 'max-width':'800px', 'overflow-y':'auto'}">
Thank you.
Code: Select all
<p-dialog [contentStyle]="{'max-height':'600px', 'max-width':'800px', 'overflow-y':'auto'}">
Code: Select all
@ViewChild('browseDialog', {static: true}) browseDialog: Dialog
Code: Select all
ngOnInit() {
this.browseDialog.onShow.subscribe({
next: this.handleOnShow.bind(this)
});
}
Code: Select all
handleOnShow() {
this.browseDialog.contentViewChild.nativeElement.addEventListener('scroll', this.scroll.bind(this));
}
Code: Select all
scroll(e: Event) {
let scrollTop: number = this.browseDialog.contentViewChild.nativeElement.scrollTop;
let scrollMax: number = this.browseDialog.contentViewChild.nativeElement.scrollHeight - this.browseDialog.contentViewChild.nativeElement.clientHeight;
if (!this.noMoreBlueprints && !this.working && scrollTop == scrollMax) {
this.loadMoreBlueprints();
}
}
Users browsing this forum: No registered users and 5 guests