MdIqubal / Recyclable-Scroll-Rect

Recyclable Scroll Rect reuses or recycles the least number of cells required to fill the viewport. As a result a huge number of items can be shown in the list without any performance hit.
https://www.polyandcode.com
MIT License
559 stars 67 forks source link

How to set a new DataSource? #3

Closed Big3Software closed 4 years ago

Big3Software commented 4 years ago

Thanks for your great work!

Is there a way to set a new DataSource?

Currently, when I set a new DataSource or update items in the DataSource nothing happens.

Maybe you can add a "Reset" function?

Jus

CORRECTION: It's seems to be only a problem when the new DataSource has fewer elements than the original one.

MdIqubal commented 4 years ago

Hi. Glad that you liked the work. Thank you for pointing that out. That is indeed an issue. There was a huge amount of refactoring of code in the last update and this part was missed. We do need a reset function or assigning a new datasource should automatically reset the list. I will fix this issue and update the repo ASAP.

MdIqubal commented 4 years ago

The issue has been fixed and updated. After assigning a new data-source you can now call the ReloadData() function. Alternatively, the ReloadData(IRecyclableScrollRectDataSource dataSource) function can also be used for assigning a new data-source and reloading the data in a single line.

Big3Software commented 4 years ago

Cool, thanks!