Hiding an predictive search panel when repeater is empty

Hello.

I made a predictive search component and it works great except for one small thing. The predictive search panel shows filtered entries from a repeater widget and the so as you type more characters the number of items in the repeater filters down. Sometimes it can filter down to 0 (see screenshot) which is the correct behavior. But when the repeater goes down to 0, I would like to hide the panel altogether, so all that appears is the search field.

I’ve tried adding conditions using the ‘visibleItemcount’ and itemcount’ variable to the search field, but can’t figure out how to hide the panel immediately when the repeater items drop to 0…and for that matter re-show the panel if the item count goes above 0 as a result of editing the search field text. Hope that makes sense. All assistance is greatly appreciated. I’ve attached an .rp file of the component.

-adam

for_upload_01.rplib (97.1 KB)

Hi!

Looks like you are using a border around the repeater with padding. Try this:

Right-click the repeater and choose Create Dynamic Panel. This will encase the repeater in a panel that is Fit to Content, which is important for this solution. If you already have a panel around it, make sure it is Fit to Content and add the code below to that one.

Then, assuming the repeater’s top border padding is 5 and its bottom border padding is 5, add the following code to the dynamic panel containing the repeater:

On Resized
  If value [[This.height]] equals 10
    Hide This
  Else if true
    Show This

The panel because it is Fit to Content will always be the same height as the repeater, so when there are no rows, the panel’s height will be the top padding plus the bottom padding.

Beautiful Thanks so much. Worked like a charm.

1 Like

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