Dropdown filter deletes

Hello all,

on my site there are 2 dropdown. The first dropdown gets grouped with code so that no duplicates are shown.
The second dropdown filters than based on the chosen value from dropdown 1 the dataset and only gives back the data that matches the filter.
Both works normally fine. But after I have chosen in the second dropdown my value it seems that it deletes automatically the chosen option from dropdown 1 and with thtat also my selection from dropdown 2.
It happens as soon as I have chosen something in dropdown 2.
If there is only one possible selection in dropdown 2 and I don’t click it again it seems to keep everything.

In the code is also something where the pricing plan gets asked, but thats independent from the dropdowns.

import wixUsers from'wix-users';
import wixPaidPlans from 'wix-paid-plans';
import wixWindow from 'wix-window';
import wixLocation from 'wix-location';
import wixData from 'wix-data';

$w.onReady(function () {

// diese Funktion löscht Duplikate aus dem Dropdown Kategorie und zeigt diese sortiert an
$w.onReady(() => {
    loadKategorie();
});

// Load continents dropdown using the distinct() function on the query
function loadKategorie() {
 // Run a query that returns all the items in the collection
    wixData.query("Kategorie")
 // Get the max possible results from the query 
        .limit(1000)
        .ascending("oberkategorie")
        .distinct("oberkategorie")
        .then(results => {
 let distinctList = buildOptions(results.items);
 // unshift() is like push(), but it prepends an item at the beginning of an array
            distinctList.unshift({ "value": '', "label": 'Alle' });
 // Call the function that builds the options list from the unique titles 
            $w("#dropdown1").options = distinctList;
        });
}

function buildOptions(items) {
 return items.map(curr => {
 // Use the map method to build the options list in the format {label:uniqueTitle, value:uniqueTitle}
 return { label: curr, value: curr };
    });
}

// diese Funktion fragt ab ob der aktuelle User Premium Mitglied ist und blendet bestimmte Felder ein/aus je nach Preisplan
let user = wixUsers.currentUser;        //fragt den aktuellen User ab

user.getPricingPlans()                  //fragt den aktuellen Preisplan des Users ab
  .then( (pricingPlans) => {

 let firstPlan = pricingPlans[0];
 let planName = firstPlan.name;

 if (planName === "Premium") {
        $w("#checkboxGroup1").enable()
        $w("#uploadButton2").enable()
        $w("#uploadButton3").enable()
        $w("#uploadButton4").enable()
        $w("#uploadButton5").enable()
    } else  {
        $w("#checkboxGroup1").disable()
        $w("#uploadButton2").disable()
        $w("#uploadButton3").disable()
        $w("#uploadButton4").disable()
        $w("#uploadButton5").disable()
    }
  } )});

 

//soll Unterkategorie Filtern je nachdem was bei Oberkategorie ausgewählt wurde
export function dropdown3_click(event) {
 let filter = $w("#dropdown1").value; //setzt die variable Filter je nachdem was bei OBerkategorie eingegeben wurde
$w("#dataset2").setFilter(wixData.filter()
    .eq("oberkategorie", filter) //filter im Datensatz die Spalte oberkategorie nach der variable filter
);
}
  1. I don’t see in your code where you set the options for dropdown3.
  2. Does it log an error to the console?