visibleItemCount doesn't work correctly with facet filtering

Hello helping community,

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!

What is the trick?

Here is live preview and my file:
PA-FacetFiltering-Issue.rp (263.0 KB)

Hi @Estel,

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


Hope that helps!

1 Like


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​.

1 Like

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.

1 Like

Hi guys,

Many thanks for your replies, I do confirm that adding Wait action (100ms) solved the issue!
I wish all problems shall be solved so easily ))

Thanks again!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.