[SailfishDevel] SilicaListView.scrollToBottom() after appending to a listmodel

chriswilty chriswilty at zoho.com
Fri Feb 28 09:12:02 UTC 2014


Excuse the noobie question, I must be doing something obviously wrong... So hopefully the old hands can help.

I have a SilicaListView backed by a ListModel, and a pulley-menu command to add an item to the end of the model via ListModel.append(). After adding, I want to scroll the SilicaListView to the bottom to make the newly added item visible. So I thought using scrollToBottom() would do just that:

function addNewItem() {
  myListModel.append({ "role1": 0, "role2": 0 });
  mySilicaListView.scrollToBottom();
}

However, the view scrolls to the item above the one I just added, as if the view has not yet updated. Should I be binding the scrollToBottom() call to ListView.onAdd() instead? And if so, should I do that in my function so that it is only bound when first needed, for efficiency reasons? Or am I doing this all wrong, should I be using currentItem and highlightFollowsCurrentItem instead?

Many thanks,
Chris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20140228/704f2920/attachment.html>


More information about the Devel mailing list