I am using setFilter to filter a dataset on a page based on a user action (i.e. click on a cell in a table) and a repeater to display the data from the dataset after filtering.
Sometimes a user will click a cell which will filter out all data in the dataset because there is not currently any data in the collection for that selection. Is there a way to return a message to the user them the there is no data in the collection for that filter action?
Hello truthandlies!
-
First you’ll want to check if the results received from the promise have a length that are less then 1 or return null, if they do then that means there is no data to show based off of the filters selected
-
Then you’ll want to expand/show the error message that is collapsed/hidden by default, and maybe set a timeout to hide it again after 3 seconds.
Please post some code so I can help out with the implementation if needed.
General example of how it would look:

EDIT: Wix has a built in query that returns items in a collection that have an empty value for a specific property, Look at: https://www.wix.com/code/reference/wix-data.WixDataFilter.html#isEmpty