top of page
Forum Posts
Elise Forget
Aug 06, 2018
In Coding with Velo
Please I need help, I have followed the wix tutorial and everything works apart from the search bar . What have I done wrong? thanks import wixData from "wix-data";
$w.onReady(() => {
loadActivity();
});
let lastFilterTitle;
let lastFilterName;
let debounceTimer;
export function iTitle_keyPress(event, $w) {
if (debounceTimer) {
clearTimeout(debounceTimer);
debounceTimer = undefined;
}
debounceTimer = setTimeout(() => {
filter($w('#iTitle').value, lastFilterName);
}, 500);
}
export function iActivity_change(event, $w) {
filter(lastFilterTitle, $w('#iActivity').value);
}
function filter(title, name) {
if (lastFilterTitle !== title || lastFilterName !== name) {
let newFilter = wixData.filter();
if (title)
newFilter = newFilter.contains('locationTitle', title);
if (name)
newFilter = newFilter.contains('name', name);
$w('#dataset1').setFilter(newFilter);
lastFilterTitle = title;
lastFilterName = name;
}
}
function loadActivity() {
wixData.query('Activity')
.find()
.then(res => {
let options = [{"value": '', "label": 'All Activities'}];
options.push(...res.items.map(name => {
return {"value": name.title, "label": name.title};
}));
$w('#iActivity').options = options;
});
}
0
7
95
Elise Forget
Aug 04, 2018
In Coding with Velo
Hi, I have watched the video "How to create a search for your database" I have created my database, the dropdown works fine but I can not get the search input to work. Please what is wrong with my code below? (see attached screen shots) Thank you import wixData from "wix-data";
$w.onReady(() => {
loadActivity();
});
let lastFilterTitle;
let lastFilterName;
let debounceTimer;
export function iTitle_keyPress(event, $w) {
if (debounceTimer) {
clearTimeout(debounceTimer);
debounceTimer = undefined;
}
debounceTimer = setTimeout(() => {
filter($w('#iTitle').value, lastFilterName);
}, 500);
}
export function iActivity_change(event, $w) {
filter(lastFilterTitle, $w('#iActivity').value);
}
function filter(title, name) {
if (lastFilterTitle !== title || lastFilterName !== name) {
let newFilter = wixData.filter();
if (title)
newFilter = newFilter.contains('locationTitle', title);
if (name)
newFilter = newFilter.contains('name', name);
$w('#dataset1').setFilter(newFilter);
lastFilterTitle = title;
lastFilterName = name;
}
}
function loadActivity() {
wixData.query('Activity')
.find()
.then(res => {
let options = [{"value": '', "label": 'All Activities'}];
options.push(...res.items.map(name => {
return {"value": name.title, "label": name.title};
}));
$w('#iActivity').options = options;
});
}
0
0
72
Elise Forget
Aug 03, 2018
In Coding with Velo
Hi, I have watched many of your tutorial videos and read your information pages with no success. there always seems to be something missing, even when following the instructions. I am creating a site where I need a dropdown search. The client would click the dropdown, the client clicks on an item in the list, which takes them to that item page (using a dataset). Please see attached images this is what I would like to create. Thanks
0
2
111
Elise Forget
More actions
bottom of page