ngx-virtual-scroller icon indicating copy to clipboard operation
ngx-virtual-scroller copied to clipboard

Question: How to get the position of an item in the list?

Open malwatte opened this issue 4 years ago • 2 comments

Can anyone please tell me how to get the position of a child item with respect to the scroll view?

I want to check if an item is close to the bottom of the view. virtualScroll.viewPortInfo.endIndex does not work for me because the unequal item size.

Thanks.

malwatte avatar Jul 24 '20 10:07 malwatte

virtualScroll.viewPortInfo.startIndexWithBuffer + index

This one if enableUnequalChildrenSizes is enabled.

rickwalking avatar Jul 27 '20 14:07 rickwalking

I checked that but did not work. I actually need to check how close an item to the bottom of the view. e.g. 10px to the bottom. Indexes are not enough because of enableUnequalChildrenSizes enabled. This is not just for the very last item in the list, but for any item.

There is an expand button in the item. When user clicks it, item gets expanded. If the item is close to the bottom of the scroll view, users cannot see the expanded section of item. I need to scroll down a bit so that the expanded section is visible.

Thanks

malwatte avatar Jul 31 '20 08:07 malwatte