Hi guys,
I got a search module, like property search, with dropdown, and a "find button, all results appears in a repeater. i would like to display a message no results in case of no data.
here is my code, please can you tell me with code i have to add and where, super thx in advance…
here is my code :
import {wixData} from ‘wix-data’;
export function button1_click(event, $w) {
$w(“#dataset1”).setFilter(wixData.filter()
Thanks you quick answer, her’s what i got no w:
I’ve inserted the line : results.items.length === 0 ? $w(#“textMessege”).text = “sorry no results” :
Says that (#'textMessege") is not a valid selector…
But the only thing is : when there’s results, the text “sorry no results” stay still… i need also the code on the other side, so when there is results, a texte “here is your results” replace the “sorry no results”
here is the code i created on your advice and working lovely : so i got same text (text80) that displays “no results” when no results, and “voici vos résultats” (french when there’s at least 1 result :
I have tried to follow this but I’m still having problems.
All I’m trying to achieve at the moment is to write to the console the number of records. I can make this happen but it is always one step behind.
With no filter I have 300 records.
I filter the gallery down to 29 records the console prints 300 (29 images are shown in the gallery)
I filter again down to 17 records the console prints 29 (17 images are shown in the gallery)
…
First of all, I don’t know why you bother to pass parameters to the filter() function if you don’t use them inside the function at all.
Second, without seeing the error messages, I think I won’t be able to help.
Third, I don’t see the .then() part, and without it nothing is going to happen (the dataset will get filtered but you won’t see the filtering effects).
Hi, I don’t know whether you are still working on this matter, but I have come up with an easy solution for this with out the code.
If there is no data then repeater will not be displayed automatically
So, what you need to do is,
Just put a text box with “Sorry, No data” behind your repeater and bring your repeater forward. So, when there is data your repeater will be shown up and when there is no data repeater will be automatically hid, so your text box will be displayed.