Q:

Polymer paper-dropdown-menu initialy selected not displayed in label

Using the following code I would like "Option 1" to be displayed on page load. Instead "Label Here" is displayed. When clicking the drop down Option 1 is in bold showing it is selected. If I click Option 1 then the label updates and is correct
<paper-dropdown-menu label="Label Here" selected="0">
<paper-menu class="dropdown-content" selected="0">
<paper-item >Option 1</paper-item>
<paper-item >Option 2</paper-item>
</paper-menu>
</paper-dropdown-menu>

This is using the latest component from Github
  "dependencies": {
    "polymer": "1.0.8",
    "iron-elements": "1.0.3",
    "paper-elements": "PolymerElements/paper-elements#1.0.3",
    "page": "1.6.3",
    "adal-angular": "1.0.4",
    "moment": "2.10.6",
    "jaydata": "1.3.6",
    "bootstrap": "3.3.5",
    "paper-dropdown-menu": "PolymerElements/paper-dropdown-menu#1.0.1"

  }

Is this a bug or am I doing something wrong?
Thanks!
Daniel

A:

The selected attributes works with paper-menu, not with paper-dropdown-menu. But the latter's selectedItemLabel is computed and selectedItem is readOnly. The only way I found to preload selected item is to fire 'iron-activate' event, not sure that it's optimal though.
<dom-module id="my-test">
    <template>
        <paper-dropdown-menu id="dropdownMenu" label="Label Here" >
            <paper-menu id="menu" class="dropdown-content" selected="0">
                <paper-item id="option1">Option 1</paper-item>
                <paper-item id="option2">Option 2</paper-item>
            </paper-menu>
        </paper-dropdown-menu>
    </template>
    <script>
        Polymer({
            is: 'my-test',
            ready: function(){

                this.$.menu.dispatchEvent(new CustomEvent('iron-activate', {
                    bubbles: true,
                    cancelable: true,
                    detail: {
                        item:this.$.option2,
                        selected:1
                    }
                }));
            }
        });
    </script>
</dom-module>

