Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

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

— asked September 27th 2010 by tom kom
  • scrolltoindex
  • tableview
  • window
0 Comments

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.

    — answered March 13th 2013 by remko posthuma
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.