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

chriswilty chriswilty at zoho.com
Thu Mar 13 10:03:49 UTC 2014


Well, the response was underwhelming...

In any case, I sort of solved my issue by using the currentItem/Index way, although when adding the first new item, I do get a strange delay before the animation kicks in. When adding items after that, it works fine.

Chris

---- On Fri, 28 Feb 2014 11:12:02 +0200 chriswilty <chriswilty at zoho.com> wrote ---- 


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

_______________________________________________ 
SailfishOS.org Devel mailing list


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


More information about the Devel mailing list