diff --git a/src/app/components/table/table.ts b/src/app/components/table/table.ts index 6e406df5a91..6845e63a5f9 100755 --- a/src/app/components/table/table.ts +++ b/src/app/components/table/table.ts @@ -353,7 +353,7 @@ export class Table implements OnInit, AfterViewInit, AfterContentInit, Blockable @ViewChild('wrapper') wrapperViewChild: ElementRef; - @ViewChild('table') tableViewChild: ElementRef; + @ViewChild('table', { static: false }) tableViewChild: ElementRef; @ViewChild('tableHeader') tableHeaderViewChild: ElementRef; @@ -1801,7 +1801,7 @@ export class Table implements OnInit, AfterViewInit, AfterContentInit, Blockable if (this.virtualScrollBody) { this.virtualScrollBody.scrollTo(options); } - else { + else if (this.wrapperViewChild?.nativeElement) { if (this.wrapperViewChild.nativeElement.scrollTo) { this.wrapperViewChild.nativeElement.scrollTo(options); }