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

Question: Clear or set paper-dropdown-menu value #39

Closed alexhuot1 closed 9 years ago

alexhuot1 commented 9 years ago

Hi,

I can't find a way to clear a paper-dropdown-menu. I would like to reset it to its initial state when my form is sent (ajax). I can't find anything in the demos or doc.

Also, is it possible the set the value. Exemple: pre-selected value.

Thanks a lot

Compufreak345 commented 9 years ago

I can sign this issue, I found a quite dirty workaround and posted in on your StackOverFlow-post : http://stackoverflow.com/a/32592333/3085985

(Please don't judge me for the dirtyness, there right now is no other way I can think of and maybe it helps someone stumbling across this issue)

shans commented 9 years ago

It's actually possible to clear the selection of a paper-menu, by setting menu.selected = null.

However, if you do this on a paper-menu inside a paper-dropdown-menu, the cleared selection doesn't propagate upwards correctly (this is a bug).

It's possible that this is because the paper-dropdown-menu listens to iron-select events but not iron-deselect events.