Hi guys, I have a page that has a repeater connected to a dataset. (Just trying to replicate the youtube video with dataset search for continents and countries etc)
The problems I’m having are as follows:
All of a sudden the repeater does not display at all, but in preview it does.
When I check in inspector I can see that the repeater container box is there but does not
display.
I have 2 buttons on top, 1 for search and the other as a drop-down.
The buttons are called iTitle and iContinent. But they don’t work.
Through the preview window I can see that the content via the dataset is loading and displaying.
Also in the wix code I see an error message stating parameter event is never used.
Here is my code:
import wixData from “wix-data”;
$w.onReady(() => {
loadContinents();
});
let lastFilterTitle;
let lastFilterContinent;
let debounceTimer;
export function iTitle_onkeyPress(event, $w) {
if (debounceTimer) {
clearTimeout(debounceTimer);
debounceTimer = undefined;
}
debounceTimer = setTimeout(() => {
filter($w(‘#iTitle’).value, lastFilterContinent);
}, 500);
}
export function iContinent_change(event, $w) {
filter(lastFilterTitle, $w(‘#iContinent’).value);
}
function filter(title, continent) {
if (lastFilterTitle !== title || lastFilterContinent !== continent) {
let newFilter = wixData.filter();
if (title)
newFilter = newFilter.contains(‘articleTitle’, title);
if (continent)
newFilter = newFilter.contains(‘continent’, continent);
$w(‘#dataset1’).setFilter(newFilter);
lastFilterTitle = title;
lastFilterContinent = continent;
}
}
To be honest, I’m having a little trouble following your code as I can’t see the page itself. Please post the URL of your site. Only authorized Wix personnel can get access to your site in the editor.
So far I found that your text input field and your dropdown were not connected to the event handlers, therefore nothing happened. You need to set these in the property panels of the relevant components:
Here is the Properties panel of the text input field:
Also, you need to make sure that you use the Field Key of the collection, therefore:
not this: newFilter = newFilter.contains(‘articleTitle’, title);
rather this: newFilter = newFilter.contains(‘title’, title);
I didn’t go over all of your code. Make these changes and I’m sure that with some careful review of your code and logic you’ll be able to get your page working. We are here to help out the best we can if you run into problems.
hi, I got the search box working except sometimes displays too much data. My articles database has Article title with 4 values Article 1, Article 2, Article 3, Article 4. if I enter value 1 it is ok. But when I enter value 2 it shows 2 but also 1. This should not happen. Also I’m a little bit confused with when you hardcode some and when using the properties panel for change or keypress events. If we hardcode everything, then I enter in the properties I.e keypress then it adds a new line to that code, even though we already have it there hardcoded.