scrolltoindex when creating tableview
hi,
i use the "scrolltoindex" method after a user interaction. it works as expected.
but when creating a larger tableview. i want the user to see the latest entry (which is at the bottom).
i tried putting scrolltoindex directly after the creation of the tableview.
also i implemented an "open" eventlistener of the window and put the scrolltoindex there.
both to not work.
anyone has an idea how to do this ?
thanks
tom
1 Answer
-
I find that, particularly on Android, you have to put the scrollToIndex() command in an event handler that wait for the table to be fully created and shown. For iOS it's enough to wait for the 'postlayout' event. Make sure to check that the event source is your table, since each of the rows will also fire a postlayout event and they will bubble up. For Android, you may additionally have to build in a short timeout. Firing the scrollToIndex command too early means it just doesn't get heard.