Hide Repeater contents based on Data?

Hi @danyminko ,

Yes, I tested it.

https://yevhenp.wixsite.com/search-example

When you’re in preview mode, open Developer Console to see if there’s an error.

Also make sure you’ve checked Collapsed on load in the properties of the repeater.

Hi @yevhen-pavliuk
Thank you for your reply. I Actually got around to finding a temporary solution.

It is located on the home page (just like your example), the table (this time its a table solely for design purposes) collapses on load, and is expanded when the input field (search bar) has been typed into.

The issue is that I would still like to have had this in my header, but that’s hard to do as the repeater would show on the new page, and the search box would still have the previous entered text. I’m hoping in finding the solution sometime in the future.

Do you know what code I could add to make the table/repeater collapse on new page load, and have the search box set to == (null) on new page load as well? And then of course the table would automatically appear once text is typed into as the code below demonstrates.

This is my current code:
export function searchbar_keyPress(event) {
// Runs a query on the “recipes” collection
wixData.query(“Game”)
// Query the collection for any items whose “Name” field contains
// the value the user entered in the input element
.contains(“gamename”, $w(“#searchbar”).value)
.find() // Run the query
.then(res => {
// Set the table data to be the results of the query
$w(“#resultsdropdown”).rows = res.items;
$w(“#resultsdropdown”).expand();
});
}

Hi @danyminko ,

Have you watched the video tutorial I mentioned earlier?

It explains some pitfalls with search implementation. Especially with the use of onKeyPress and possible race condition because of multiple search requests sent on every key stoke.

Do you know what code I could add to make the table/repeater collapse on new page load, and have the search box set to == (null) on new page load as well?
If you marked the repeater as Collapsed on load , it’ll be collapsed on every page load.

The value of input fields are also reset when a page reloads.

If these things don’t happen it means you’re staying on the same page.