Hi Wix-Forum
I try to Filter a List with those 2 referenced row.
![](https://static.wixstatic.com/media/a27d24_a2c2f205046244e1935cc83b5faf1fce~mv2.png/v1/fill/w_980,h_268,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/a27d24_a2c2f205046244e1935cc83b5faf1fce~mv2.png)
For that I have 2 Dropdown (Responsable is for Guide & Region for Region)
and 1 Dataset that is connected to the List
![](https://static.wixstatic.com/media/a27d24_c876971fbe124adab6f8a4325b0ab3df~mv2.png/v1/fill/w_980,h_622,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/a27d24_c876971fbe124adab6f8a4325b0ab3df~mv2.png)
To fill out the Dropdowns is use this Code and that works perfect:
$w.onReady(() =>{
loadRegion();
loadGuide();
});
function loadRegion(){
wixData.query('Region')
.find()
.then(res =>{
let options = [{"value": '', "label": 'Alle Regionen'}];
options.push(...res.items.map(regions => {
return {"value": regions.title, "label": regions.title};
}));
$w('#dropdownRegion').options = options;
});
}
function loadGuide(){
wixData.query('GuidesDB')
.find()
.then(res =>{
let options = [{"value": '', "label": 'Alle Guides'}];
options.push(...res.items.map(regions => {
return {"value": regions.title, "label": regions.title};
}));
$w('#dropdownGuide').options = options;
});
}
And the Code for the Filter:
let lastFilterGuide;
let lastFilterRegion;
export function dropdownRegion_change(event){
filter(lastFilterGuide, $w('#dropdownRegion').value)
}
export function dropdownGuide_change(event) {
filter($w('#dropdownGuide').value, lastFilterRegion)
}
function filter(guide, region){
if(lastFilterGuide !== guide || lastFilterRegion !== region){
let newFilter = wixData.filter();
if(guide){
newFilter = newFilter.contains('responsable', guide);
}
if(region){
newFilter = newFilter.contains('region', region);
}
$w('#datasetCollection').setFilter(newFilter);
lastFilterRegion = region;
lastFilterGuide = guide;
}
}
But if I choose something out of one of the Dropdowns everything dissapear and the List is blank - so the filter is not working.
I have read that referenced field so not working, how can I fixt that?
Hope someone can help.
Does nobody now how to do that? - Filtering Values from a Collection with References via two Dropdowns!
You will have two include all parameters on the filter you're setting, so not just the current one but all of them