ScrollIntoView on ListView Element by index - help

Hi there!

I am having trouble getting the "scrollInIntoView" function to work inside a listView.
I have a listView component with a fixed height and a scrollable overflow, I have a button with which an entry is added to the bottom of the listView. I want that the new row of the listView is scrolled into view after adding it.
I tested the same thing with a form and overflow and scrolling a button on the form into view - works fine: button1.scrollIntoView(). But with the listView I can't get it to work.

I tried targeting the last element inside the listView by Index like so:[ - 1].button1.scrollIntoView(). I already noticed at that point that the button1 element had no intellisense suggestions.

It seems like this is not supported which honestly surprises me. Also the fact I am the first requesting such a thing. But maybe someone here can enlighten me. Thanks in advance!

Hello, you can try this instead


Have you tested it? Because for me that doesn't work either, I suppose because button3 is not a list element. I guess it is not possible right now.

Hello, this works for me


Oscar's solution seems to be erroring out for me in the new list view, but it works in the legacy listView:

I've shared this feedback with the team that owns the new list view, but currently indexing into listView child components isn't supported in the new list view.

Would it work for your use case to sort newest to oldest so that the new item is always visible at the top of the list?

Hello, i dont have the new List View component. can i test it somehow?


Yeah, it does not work in ListVew v2 because you cannot reference the child components as if they were an array - button1[idx] does not work - unless that has been added recently?

@bradlymathews the button1[idx] approach has not been added for listView v2

@Oscar_Ortega We are gradually rolling it out, so it sounds like it hasn't been rolled out to your account yet. I went ahead and added it. Let us know what you think!

1 Like

new List View has a scrollToIndex function, it works as scrollIntoView()

new components looks great!

1 Like

:pray: :laughing: Oh nice! Thank you!

1 Like

but the smooth scroll is buggy

I see what you mean! Flagging internally as a bug. Thanks!

Hello @Tess

If possible could you add my org/account into the rollout as well?

Hi there! All Cloud organizations should have listview v2 by default now :blush: It should be rolling out to on-premise within a few weeks

1 Like