kiiii
New Member
Posts: 2
|
Post by kiiii on Feb 12, 2019 23:09:23 GMT
hello how can load more item from web json when scroll position go to end of listview i can get data with json from web i do not problem about get data with json but your package do not have any example about this feature load more data end of listview scrolling
thank you lot of
|
|
|
Post by echo17 on Feb 13, 2019 14:25:44 GMT
You can handle the scrollerScrolled delegate of the EnhancedScroller. Just add the handler right after you set the scroller's delegate to the controller. Something like:
scroller.Delegate = this; scroller.scrollerScrolled = ScrollerScrolled;
Then in the handler, you can check the position of the scroller. If it is at the bottom (or right in the case of a horizontal scroller) then you can add data and reload. Something like:
private void ScrollerScrolled(EnhancedScroller scroller, Vector2 val, float scrollPosition) { if (scroller.NormalizedScrollPosition == 1f) { _data.Add(new Data() { someText = "New Row" }); scroller.ReloadData(1f); } }
|
|
kiiii
New Member
Posts: 2
|
Post by kiiii on Feb 13, 2019 15:39:57 GMT
thank you lotf of
but this script sample have another problem after loading new data in end of the listview dont added new data and needed scrolling up and scrolling down again
can you help and slove this issue
thank you
|
|
|
Post by echo17 on Feb 14, 2019 14:06:04 GMT
I'm not sure what you mean. Be sure you call ReloadData after adding new data in the controller. That will refresh the scroller and show the newly added items.
|
|
|
Post by nolkeg on Oct 14, 2020 7:04:11 GMT
thank you lotf of but this script sample have another problem after loading new data in end of the listview dont added new data and needed scrolling up and scrolling down again can you help and slove this issue thank you Vector2 anchorPos = scroller.ScrollRect.content.anchoredPosition; scroller.ReloadData(); scroller.ScrollRect.content.anchoredPosition = anchorPos; use this code to reload data at the same position
|
|