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: listView1.data[listView1.data.length - 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!
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?
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!