How do I make a “No Results Found” Message for repeater items that have no data according to my Dataset filter settings.
I’m re-developing my CPR site on Wix Studio but would love to know on Wix Editor Too as my current website is still live.
What are you trying to achieve:
I have datasets filtered to either a boolean or a date that goes into a repeater. I would like to add a message “No classes found” when there is no data to load according to my filter logic.
What have you already tried:
I don’t know where to start. I looked at multiple search’s and pages put it hard for me to understand.
Additional information:
I’m a novice to coding but love to dable. Any hand holding would be apricated cause I love to learn.
What if I told you there’s a more simpler way to do this that does not involve coding anything at all, just tricky element placement - that’s it!
Check this post out:
And if you want to do it the hard way and dive into the world of Velo, you can surely code this functionality too. The only thing being that the dataset does not have an event handler such as onFilterApplied() so unfortunately you would have to either handle the entire filtering using code itself, or would have to call thegetTotalCount() on loop to check if the result is 0, indicating that the user applied a filter where no matching items were found and show the message (which I personally would NOT recommend).
You would be wondering why can’t the getTotalCount() function be called when a dropdown or a date range slider is changed? That is because the dataset may take a second or two to apply the filter, and your code would return the number of items before the filter is even applied, failing to show the message to the user.
So all I’m trying to say is yes this seemingly simple functionality is very much codeable, however it may get a little too much for people who are not familiar or are just getting started with Velo… so if the easy peasy no-code workaround works for you and can save all the extra time and effort, that’s the way to go.
That’s totally okay!
Here’s a personal tip -
You may want to look into getting help from AI chat assistants such as ChatGPT or Gemini, these really do a great job in explaining and answering the nitty-gritty details of how code works, I’d highly recommend that you give it a shot - its equally helpful for newbies and experienced devs alike. And then there are the hoards of tutorials on YouTube and other places, and then of course you can reach out to this community and the members here will try their best to help you as and when they get the time. There is always a possiblity someone might have encountered the same problem before you, and chances are there is a solution lying right there! So I’d always recommend taking some time to look up the forum for similar questions. And maybe… you could even find such tricky workarounds which can come to the rescue and save you from writing lines and lines of code!