Hi,
We have 2 drop-down menus and a search bar (see below). All three work independently however we want them to work together to filter a career database. See the site here www.careerbiz.online/
If we filter by location it works fine. But when we try to refine the search with a second filter (all classifications) it resets the ‘location’ filter meaning you can’t filter by both ‘location’ and ‘classification’ simultaneously.
Here is what we have called our various inputs.
-
Search bar = ’ #input1 ’
-
Location drop down = ’ #location1 ’
-
Classification drop down = ’ #classification ’
-
Table = ’ #table1 ’
-
Dataset = ’ #dataset2 ’
-
Database = ‘careers’
We have not had any luck with this question on previous Wix Forum threads. The full code is below, could anyone help us rewrite it and solve our problem? We would be so grateful!!!
Full code:-
Search bar = ’ #input1 ’
Location drop down = ’ #location1 ’
Classification drop down = ’ #classification ’
Table = ’ #table1 ’
Dataset = ’ #dataset2 ’
Database = ‘careers’
export function input1_keyPress_1() {
wixData.query(‘careers’)
.contains(‘title’, $w(‘#input1’).value)
.find()
.then(res => {
$w(‘#table1’).rows = res.items;
});
}
export function location1_change(event, $w) {
wixData.query(‘careers’)
.contains(‘location’, $w(‘#location1’).value)
.find()
.then(res => {
$w(‘#table1’).rows = res.items;
$w(‘#table1’).show();
});
}
export function input1_viewportEnter(event, $w) {
wixData.query(‘careers’)
.contains(‘location’, $w(‘#location1’).value)
.find()
.then(res => {
$w(‘#table1’).rows = res.items;
$w(‘#table1’).show();
});
}
export function classification_change() {
wixData.query(‘careers’)
.contains(‘category’, $w(‘#classification’).value)
.find()
.then(res => {
$w(‘#table1’).rows = res.items;
$w(‘#table1’).show();
});
}