Waiting for dataset to filter before showing elements

Hey guys!

I have a filter on a page which only shows the content from the author, this works fine however for the first few seconds before the the code filters the dataset it displays the content from everybody!

My question is how to I get the repeater to appear after the dataset has been filtered, not before. The repeater element is already hidden on load, and is set to show on the last line of code, however this executes before I want it to.

Its probably very simple to do but I cannot seem to get this to work!

Please help!

My current page code

$w.onReady(function () {
$w(“#dynamicDataset”).onReady(() => {
let userId = wixUsers.currentUser.id; //Get unique user ID

	//Set dataset's filter to display data based on user ID 
	$w("#dynamicDataset").setFilter(wixData.filter() 
		.eq("_owner", userId)); 
	$w('#repeater1').show();

Hey there Spidey,

I would suggest doing the .show() in the .onItemReady() function which is where the repeater starts displaying the content that you actually want.

$w("#repeater1").onItemReady( ($w, itemData, index) => {
	$w("#repeater1").show(); // or .expand() - whatever works for you
        // repeater item stuff goes here
});

Yisrael

Hi,
I have a similar code above but the repeater1 doesn’t show at all. It looks like it updates because the strip that it’s in resizes according to how many results it finds but it just doesn’t show them. Any ideas why?

Hi Ambitious,

Do you have some screenshot of your issue??

Here is sample of my code

$w.onReady(function () {
let searchWord = $w(“#searchbox”).value;

//Filter dataset $w(“#dataset1”).setFilter(wixData.filter()
.contains(“_title”, searchWord));
//…set results to ”#repeater1

$w(“#repeater1”).onItemReady( ($w, itemData, index) => {
$w(“#repeater1”).show(); // or .expand() - whatever works for you
// repeater item stuff goes here
});

Hi Ambitious,

The code you posted is the same as the incomplete sample code that I posted previously. You will have to fill in the rest of the code based on your site’s requirements.

Yisrael

your suggestion doesn’t work… Wix have a big problem with synchronizing after filtering