Hello,
How to hide a repeater if it has no containers displayed.
Thank you for your return.
Have a good day
Hi Maxime, Would you like to make it more clear by uploading the screenshot and explaining the issue little bit more?
I have a repeater on my connect to database page. I added a filter on my page to the database. When we filter the database and there is no data to display in the repeater I would like the repeater to be hidden. Hope this brings more details. Have a good day
(Sorry for the wording errors I use google translation because I am French)
Thank you for further explanations. To filter, are you using dataset or if you are using queries to filter?
If you are using dataset then you will need to do $w(‘#yourdataset’).getTotalCount() inside .then() after your filter code, if total is less then 1 hide the repeater.
I filter according to the element entered by the user
Let me know if this helped. Thank you
Sorry it didn’t work. Make the user filter the dataset then the repeater display the filtered items, and that’s when I want the repeater to hide if it has no data to display?
Voici l’extrait du code
let url2 = wixLocation.url;
let source = url2;
let raccourcis = source.split("/")[5];
let filter = raccourcis
$w("#dataset1").setFilter(wixData.filter()
.eq('slug', filter)
)
I though you would get I am trying to say, anyways I did some adjustments with your code below.
let url2 = wixLocation . url ;
let source = url2 ;
let raccourcis = source . split ( “/” )[ 5 ];
let filter = raccourcis;
$w ( “#dataset1” ). setFilter ( wixData . filter (). eq ( ‘slug’ , filter )).then(()=>{
let count = $w(‘#dataset1’).getTotalCount();
if(count<1){
// hide repeater
}
})
Thank you for your answer when I add your code it doesn’t even filter the dataset anymore