Display Message When Repeater Search Returns No Results
ATTENTION: THIS IS OUR OLD SITE. TO SEE OUR NEW WEBSITE, CLICK HERE.
The following code will show you how to display a message for your website users when a search or dynamic filters on a repeater returns no results.
This code assumes you have already set up a repeater which can be dynamically filtered or searched in some way. The screenshot below shows an example of the message which is displayed when a repeater displays no results. In this case, the user searched for 'xyz' in the WixCodeBank, and no results were returned.
A function is created called resultsCheck() which determines how many rows are retrieved in the dataset #dbCodeBank. If no results are returned, a text element called #txtNoResults is displayed with a message "Can't find what you are looking for? - please contact us! ..." and the repeater collapsed (visa versa if results are retrieved). The resultsCheck() function should be called when the page loads onReady and within the filter function you are using, after the filtering has been done.
Please login or sign-up (it's free!) to view our code. Refresh the page if already logged in.
Disclaimer: To the best of our knowledge, this code works for its stipulated purpose. If you find an error in our code, or know of a better way to achieve the same result - please contact us! We will help where we can, however please be aware that the code is provided 'as is' and without a promise of support in using or implementing it.