The code does exactly what you are saying…
This is correct…
// this does clear the selectedIndex but the last option
$w('#yearDD').selectedIndex=undefined;
At this point my urgent suggestion for your future coding…
—> this looks like a good variable definition → #yearDD <— but it ins’t.
Instead invert it → “ddYear” ← use the ELEMENT-ID always —> FIRST <—
Back to your question:
A DropDown has 5 different kind of values…
a) SelectedIndex —> $w(‘#yearDD’).selectedIndex=undefined;
b) PlaceHolder -------> $w(‘#yearDD’).placeholder =“Select Year”;
c) Value ----------------->
d) Option --------------->
e) Label ------------------>
Where was your mistake?
What is the difference between a PLACEHOLDER AND AN OPTION ?
And what the hell is the Label ?
$w("#ddYear").options = [
{"label": "Label-1", "value": "first"},
{"label": "Label-2", "value": "second"},
{"label": "Label-3", "value": "third"}
];
Now your turn !!! ![]()
https://www.wix.com/velo/reference/$w/dropdown/label?_gl=1*rtnmvi*_ga*NTkxMDg0NjY0LjE2NzcyNTQ1NDI.
And —> WHAT ??? <---- YOU ARE TRYING TO USE A NOT READY DATASET ???
import wixLocation from 'wix-location';
$w.onReady(() => {
$w('#yearDD').placeholder = "Select Year";
$w('#programDD').placeholder = "Select Program";
$w('#playerDD').placeholder = "Select Player";
$w('#resetFiltersButton').onClick(() => {
$w('#yearDD').selectedIndex = undefined;
$w('#programDD').selectedIndex = undefined;
$w('#playerDD').selectedIndex = undefined;
//------------------------------------------
$w('#yearDD').resetValidityIndication();
$w('#programDD').resetValidityIndication();
$w('#playerDD').resetValidityIndication();
wixLocation.to("/edit-player-teams");
//------------------------------------------
$w('#players').refresh();
$w('#team').refresh();
$w('Table').refresh();
});
});
What are you missing here ???
Maybe something like…
$w(datasetID).onReady(()=> {
console.log("Dataset is ready.");
});
Where to put it in ?