How to collapse a gallery, if there is no data after filtering

Hello,

maybe someone could help me with the code. I have a gallery connected to a data set on my Dynamic page. And I have a code, to filter the data to be shown according the title of the dynamic page.

I need to add a new part of a code, to collapse the gallery, if there is no data to shown after the filter was applied.

Maybe someone could advise me with this part of code.

My code is:

$w.onReady(function () {
$w("#dynamicDataset").onReady(()=>{
		const title = $w("#dynamicDataset").getCurrentItem().title;
				$w("#dataset5").setFilter(wixData.filter().eq("country",title));
					});
					});

Thank you!