In my app I have a list of items. Each item has different data elements like item name, item image, etc. One of the elements is distance from current location to some place. All items has to be sorted in descending order by distance. If the device is changing its location (when the owner driving a car for example), the distance will change too. As a result the entire list will change - both the order of items and each item’s data.
I recently switched from regular scroll to virtualScroll. With regular scroll, when data set changed, the list would re-render itself automatically. With virtualScroll it doesn’t work this way. When data set changed, the list wouldn’t re-render automatically.
I have to admit I don’t completely understand how re-rendering part works in virtualScroll. It seems like I’m supposed to use virtualTrackBy. I tried and didn’t manage to make it work. But I don’t even sure that this would solve my problem.
So, couple of questions:
- Can somebody reference me to better explanation on how virtualTrackBy really works and how to implement it?
- I would appreciate any thoughts on how you would approach this problem.