PolymerElements / paper-dropdown-menu

A Material Design browser select element
https://www.webcomponents.org/element/PolymerElements/paper-dropdown-menu
61 stars 107 forks source link

reset functionality? #182

Open jay8t6 opened 8 years ago

jay8t6 commented 8 years ago

How do you reset paper-dropdown-menu to its original state?

<paper-dropdown-menu label="Choose...">
            <paper-listbox class="dropdown-content">
              <paper-item>allosaurus</paper-item>
              <paper-item>brontosaurus</paper-item>
              <paper-item>carcharodontosaurus</paper-item>
              <paper-item>diplodocus</paper-item>
            </paper-listbox>
          </paper-dropdown-menu>

I tried setting the selected property to null, that doesnt seem to work.

Inrego commented 8 years ago

try setting contentElement.selected to null. Seemed to work for me. What you're doing, is changing the selected property of the paper-listbox element, since paper-dropdown-menu doesn't have a selected property.

WoodyWoodsta commented 7 years ago

Pretty strange that there is no programmatic way to select an item - would this not be considered to be a desirable thing?

jay8t6 commented 7 years ago

add selected to the paper-listbox and update the selected value to the index value you want selected.

<paper-listbox selected="{{selected}}">
this.selected = 2;

that worked for me...