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;
}
}
function loadContinents() {
wixData.query(‘Continents’)
.find()
.then(res => {
let options = [{“value”: ‘’, “label”: ‘All Continents’}];
options.push(…res.items.map(continent => {
return {“value”: continent.title, “label”: continent.title};
}));
$w(‘#iContinent’).options = options;
});
}