Answer the question
In order to leave comments, you need to log in
How to automatically scroll to a table?
Good day,
I came across the fact that on laptops, or small screens, some forms take up a lot of space, and when you request information, a data table appears somewhere below. I decided to make the page scroll to it when the table appears. But here's something that doesn't work. Prepared a place Plunker
Tried through but get undefined this.el.nativeElement.scrollTop = 0;
Answer the question
In order to leave comments, you need to log in
There are many options, for example, one of the options .
We define the template reference variable
. We monitor the appearance of the table on the page and scroll to it if it appears.
@ViewChild('table')
set tableEl(el: ElementRefl) {
if(el) {
el.nativeElement.scrollIntoView();
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question