I have to make the search 3 levels filter 1 gender activates nationality and this activates availability. But as soon as I jump to a dynamic page I can’t go back - all filters disappear because I have an on ready function. who can solve my problem - I pray to god Many many thanks
import {local} from 'wix-storage';
import wixData from 'wix-data';
$w.onReady(function () {
let Geschlecht2= local.getItem('Geschlecht');
$w('#dropdownName1').value = Geschlecht2;
let Nationalitat2= local.getItem('Nationalitat');
//$w("#dropdownName2").enable();
$w('#dropdownName2').value = Nationalitat2;
let Verfugbarkeit2= local.getItem('Verfugbarkeit');
//$w("#dropdownName3").enable();
$w('#dropdownName3').value = Verfugbarkeit2;
uniqueDropDown1();
});
function uniqueDropDown1 (){
wixData.query("Team")
.limit(1000)
.find()
.then(results => {
const uniqueTitles = getUniqueTitles(results.items);
$w("#dropdownName1").options = buildOptions(uniqueTitles);
});
function getUniqueTitles(items) {
const titlesOnly = items.map(item => item.anrede);
return [...new Set(titlesOnly)];
}
function buildOptions(uniqueList) {
return uniqueList.map(curr => {
return {label:curr, value:curr};
});
}
}
export function dropdownName1_change(event, $w) {
local.setItem('Geschlecht', $w("#dropdownName1").value);
/////////////COUNTSTART///
$w("#treffer").show();
$w("#text116").show();
wixData.query("Team")
.contains("anrede", $w("#dropdownName1").value)
.contains("status", $w("#dropdownName0").value)
.count()
.then ((result) => {
$w('#treffer').text = result.toString()
});
///////////////COUNTEND
wixData.query("Team")
.contains("anrede", $w("#dropdownName1").value)
.contains("status", $w("#dropdownName0").value)
.limit(100)
.distinct("bundesland1")
.then(res => {
//$w("#selectionTags14").options = res.items.map(e => ({label: e, value:e}));
})
wixData.query("Team")
.contains("anrede", $w("#dropdownName1").value)
.contains("status", $w("#dropdownName0").value)
.limit(100)
.distinct("sprachen")
.then(res => {
//$w("#selectionTags13").options = res.items.map(e => ({label: e, value:e}));
})
uniqueDropDown2();
$w("#dropdownName2").enable();
}
function uniqueDropDown2 (){
wixData.query("Team")
.contains("anrede", $w("#dropdownName1").value)
.contains("status", $w("#dropdownName0").value)
.limit(1000)
.find()
.then(results => {
const uniqueTitles = getUniqueTitles(results.items);
$w("#dropdownName2").options = buildOptions(uniqueTitles);
});
function getUniqueTitles(items) {
const titlesOnly = items.map(item => item.nationalitat);
return [...new Set(titlesOnly)];
}
function buildOptions(uniqueList) {
return uniqueList.map(curr => {
return {label:curr, value:curr};
});
}
}
export function dropdownName2_change(event, $w) {
local.setItem('Nationalitat', $w("#dropdownName2").value);
/////////////COUNTSTART///
wixData.query("Team")
.contains("anrede", $w("#dropdownName1").value)
.contains("status", $w("#dropdownName0").value)
.contains("nationalitat", $w("#dropdownName2").value)
.count()
.then ((result) => {
$w('#treffer').text = result.toString()
});
///////////////COUNTEND
wixData.query("Team")
.contains("anrede", $w("#dropdownName1").value)
.contains("status", $w("#dropdownName0").value)
.contains("nationalitat", $w("#dropdownName2").value)
.limit(100)
.distinct("bundesland1")
.then(res => {
//$w("#selectionTags14").options = res.items.map(e => ({label: e, value:e}));
})
wixData.query("Team")
.contains("anrede", $w("#dropdownName1").value)
.contains("status", $w("#dropdownName0").value)
.contains("nationalitat", $w("#dropdownName2").value)
.limit(100)
.distinct("sprachen")
.then(res => {
//$w("#selectionTags13").options = res.items.map(e => ({label: e, value:e}));
})
uniqueDropDown3();
$w("#dropdownName3").enable();
}
function uniqueDropDown3 (){
wixData.query("Team")
.contains("anrede", $w("#dropdownName1").value)
.contains("status", $w("#dropdownName0").value)
.contains("nationalitat", $w("#dropdownName2").value)
.limit(1000)
.find()
.then(results => {
const uniqueTitles = getUniqueTitles(results.items);
$w("#dropdownName3").options = buildOptions(uniqueTitles);
});
function getUniqueTitles(items) {
const titlesOnly = items.map(item => item.verfugbarkeit);
return [...new Set(titlesOnly)];
}
function buildOptions(uniqueList) {
return uniqueList.map(curr => {
return {label:curr, value:curr};
});
}
}
///////
export function dropdownName3_change(event, $w) {
local.setItem('Verfugbarkeit', $w("#dropdownName3").value);
/////////////COUNTSTART///
$w("#treffer").show();
wixData.query("Team")
.contains("anrede", $w("#dropdownName1").value)
.contains("status", $w("#dropdownName0").value)
.contains("nationalitat", $w("#dropdownName2").value)
.contains("verfugbarkeit", $w("#dropdownName3").value)
.count()
.then ((result) => {
$w('#treffer').text = result.toString()
});
///////////////COUNTEND
wixData.query("Team")
.contains("anrede", $w("#dropdownName1").value)
.contains("status", $w("#dropdownName0").value)
.contains("nationalitat", $w("#dropdownName2").value)
.contains("verfugbarkeit", $w("#dropdownName3").value)
.limit(100)
.distinct("bundesland1")
.then(res => {
//$w("#selectionTags14").options = res.items.map(e => ({label: e, value:e}));
})
wixData.query("Team")
.contains("anrede", $w("#dropdownName1").value)
.contains("status", $w("#dropdownName0").value)
.contains("nationalitat", $w("#dropdownName2").value)
.contains("verfugbarkeit", $w("#dropdownName3").value)
.limit(100)
.distinct("sprachen")
.then(res => {
//$w("#selectionTags13").options = res.items.map(e => ({label: e, value:e}));
})
uniqueDropDown4();
//$w("#dropdownName4").enable();
}
function uniqueDropDown4 (){
wixData.query("Team")
.contains("anrede", $w("#dropdownName1").value)
.contains("status", $w("#dropdownName0").value)
.contains("nationalitat", $w("#dropdownName2").value)
.contains("verfugbarkeit", $w("#dropdownName3").value)
.limit(1000)
.find()
.then(results => {
const uniqueTitles = getUniqueTitles(results.items);
//$w("#dropdownName4").options = buildOptions(uniqueTitles);
});
function getUniqueTitles(items) {
const titlesOnly = items.map(item => item.ausbildung);
return [...new Set(titlesOnly)];
}
function buildOptions(uniqueList) {
return uniqueList.map(curr => {
return {label:curr, value:curr};
});
}
}
///////