I have an issue while implementing facet filtering - visible items are not being counted correctly on page load.
I made a repeater with facet filtering as described in this post and it works perfectly. Instead of checkboxes, tags are used, and click/tap toggles them selected/unselected. There is ‘Blank’ item to show if no other filters apply.
For my purpose, I need two first options be selected by default (on page load) and corresponding filtered results are shown. So I fire Click/Tap action on page load (or set them Selected in shape properties, but the issue remains in both cases). To show visible items, there is a label and its text are defined on Selected or Unselected interaction of each tag.
The issue is that visibleItemCount returns a general number of items, not actually visible.
But as long as I manually click any of tags, it shows a correct number of visible items!
It looks like the Page Load > Fire Event interaction that you’re using to trigger those filters is firing the .visibleItemCount too quickly. The elements of the repeater are seen first before they are filtered in this instance.
As a workaround for this, you can add a “Wait” action and it should resolve the issue
A workaround for this problem is to add a “Wait” action before calling visibleItemCount to ensure the filters have been applied. This delay allows the repeater to update and correctly reflect the number of visible items (Axure Forums). Another approach is to use the On Sized event of a dynamic panel containing the repeater, which adjusts the count after the filtering has taken place.
I often just set Wait to 0ms and that seems to do the trick when I encounter this, it’s a rare case that I’ll need to give it an actual length of time.