googlearchive / paper-dropdown-menu

A UI control to choose an option from a drop-down menu, similar to a <select>
23 stars 21 forks source link

Default selected option #38

Closed Arduinology closed 9 years ago

Arduinology commented 9 years ago

My Expectation here would be that 'Option 1' would be selected by default once the page loads. This is not what is happening. Instead it shows the label, not the selected option based on the paper-item value attribute.

    <paper-dropdown-menu name="dropdown" label="Dropdown" selected='1' valueattr='value'>
        <paper-dropdown class="dropdown">
            <core-menu class="menu">
                <paper-item value="1">Option 1</paper-item>
                <paper-item value="2">Option 2</paper-item>
            </core-menu>
        </paper-dropdown>
    </paper-dropdown-menu>
robdodson commented 9 years ago

I think you want to set the selected attribute on core-menu

On Wed, Dec 3, 2014 at 1:11 PM, Heath Naylor notifications@github.com wrote:

My Expectation here would be that 'Option 1' would be selected by default once the page loads. This is not what is happening. Instead it shows the label, not the selected option based on the paper-item value attribute.

<paper-dropdown-menu name="dropdown" label="Dropdown" selected='1' valueattr='value'>
    <paper-dropdown class="dropdown">
        <core-menu class="menu">
            <paper-item value="1">Option 1</paper-item>
            <paper-item value="2">Option 2</paper-item>
        </core-menu>
    </paper-dropdown>
</paper-dropdown-menu>

— Reply to this email directly or view it on GitHub https://github.com/Polymer/paper-dropdown-menu/issues/38.

Arduinology commented 9 years ago

Thank you, that works. Thought I had already tried that combination but apparently not.