Mat-Table : Scroll a row into view in angular 2
Asked Answered
S

1

6

Is it possible to scroll a specific data row into view when using the angular material mat-table cdk-table?

I'm trying to implement keyboard scrolling with no luck.

Stupor answered 6/4, 2018 at 16:40 Comment(3)
It's really difficult to understand what you are trying to achieve. Have a look at stackoverflow.com/help/how-to-askTelevisor
What i want to do is to select the next or prev row in the mat-table by the keyboard. The selection is working as expected. Now i only need to have the selected/current row visible in view. in the stackblitz example you can see it. It's a changed example of a mat-table demo. stackblitz.com/edit/…Stupor
You have something that kind of works, that's a starting point. Now, if you provide a stackblitz example of you currently have we might be able to helpTelevisor
S
3

I've it working now. Not perfect but it works.

See the example on stack blitz mentioned in my earlier message.

https://stackblitz.com/edit/mensand-rowselect?file=app%2Ftable-basic-example.html

Stupor answered 8/4, 2018 at 15:5 Comment(1)
not perfect! this is perfection in a post :D many thanks, although I did tweak your answer slightly to instead use ... @ViewChildren('partRow', {read: ElementRef}) partRows: QueryList<ElementRef>;Discretionary

© 2022 - 2024 — McMap. All rights reserved.