Best way to count visible items in x-for loop #4663
-
|
In this loop, there is a condition to show the element. At the bottom is a navigation to show more which should only appear if the number of visible items grows to "max" or above. What is the best way to know how many elements actually show up? Example: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
|
I figured it is probably easiest to filter the list before looping through it... or is there another feasable approach? |
Beta Was this translation helpful? Give feedback.
Well, easiest would be doing a filter count separately.
actually you could use css, by having a attribute or class binding that is based on if it would show but is over the max. Then the fact that exists would tell you to show the button using a peer selector.