2013.2087 widget.newScrollView scrolls to top when inserting new items

@primoz.cerar

but with scrollView, I still need to do the same thing for each row rendering. And I also need to remove & re-create rows while scrolling. So why would tableView perform worse than scrollView? or should be the same?

I don’t know how you remove and recreate rows in your scroll view, but if you realy remove all the rows that go offscreen and then recreate them when they come in to view (or close) then it should be the same.

BTW this is off topic. You can PM me if you need more info.

For those that need a quick fix for the scrolling issue  I posted it in another threadhere

You can create your own “rows” by creating an obj as true object:

local rowReferences={} local newRow={ new=function(self,obj) local sMeta=setmetatable obj=obj or {} sMeta(obj,self) self.\_\_index=self return obj end, render=function(self) self.displayGroup=display.newGroup() -- objects here print(self.isAwesome,self.coolBro) return self.displayGroup end } for i=1,50 do rowReferences[i]=newRow:new({isAwesome=true,coolBro=5}) rowReferences[i]["view"]=rowReferences[i]:render() scrollView:insert(rowReferences[i]["view"]) end -- to delete rows rowReferences[2]["view"]:removeSelf() rowReferences[2]["view"]=nil

btw, i think the reason performance is a lot better in scrollView vs tableView for me is because i have a lot of listeners in one row… When the tableView tries to add/remove so many objects while you scroll it goes completely nuts. 

Any news regarding this issue? Has it been fixed in the meenwhile? I’ve got the same problem (scrollview scrolls to top when inserting new items or even changing old ones).

I have also ran into this issue, loading more content to a scrollView will reset the scroll back to the top… Is there a plan for this fix?

I am having my users complain about this exact issue all the time… It’s quite a bad user/dev experience (loading more content to a scrollView will reset the scroll back to the top), I tried using tableView’s but the performance i get from it makes me fallback to use scrollView.

Corona, is there a fix coming for this? or is there a temporary decent fix? please!

Hi @eja,

This fix is currently being tested/approved and will presumably go out soon. Worst case, we release an open-source fix or something along those lines for users (like yourself) who need a more urgent fix. Your patience is appreciated on this.

Brent

Brent thank you so much for getting back to me so promptly, this would mean so much! Anything would help.

@eja

I am also trying to do something similar like yours, adding a lot of items into a scrollView/tableView while the user keeps scrolling down.

I am at the moment trying to choose using scrollView or tableView to do so.

When I see your earlier comment, it seems tableView performance is bad? How bad is it? So maybe I should just use scrollView directly? Any experience to share?

Thanks a lot.

Table view performance depends on the complexity of the onRowRender listener as the rows get continually recreated while scrolling. If you load large images or insert a lot of objects in the row then performance while scrolling will be bad.

@primoz.cerar

but with scrollView, I still need to do the same thing for each row rendering. And I also need to remove & re-create rows while scrolling. So why would tableView perform worse than scrollView? or should be the same?

I don’t know how you remove and recreate rows in your scroll view, but if you realy remove all the rows that go offscreen and then recreate them when they come in to view (or close) then it should be the same.

BTW this is off topic. You can PM me if you need more info.

For those that need a quick fix for the scrolling issue  I posted it in another threadhere

You can create your own “rows” by creating an obj as true object:

local rowReferences={} local newRow={ new=function(self,obj) local sMeta=setmetatable obj=obj or {} sMeta(obj,self) self.\_\_index=self return obj end, render=function(self) self.displayGroup=display.newGroup() -- objects here print(self.isAwesome,self.coolBro) return self.displayGroup end } for i=1,50 do rowReferences[i]=newRow:new({isAwesome=true,coolBro=5}) rowReferences[i]["view"]=rowReferences[i]:render() scrollView:insert(rowReferences[i]["view"]) end -- to delete rows rowReferences[2]["view"]:removeSelf() rowReferences[2]["view"]=nil

btw, i think the reason performance is a lot better in scrollView vs tableView for me is because i have a lot of listeners in one row… When the tableView tries to add/remove so many objects while you scroll it goes completely nuts.