Juravenator / paper-dropdown-input

A paper-input that provides the user with input suggestions
MIT License
20 stars 14 forks source link

Items value not Displaying properly #8

Closed michael-learns closed 7 years ago

michael-learns commented 7 years ago

Hi. I've been looking for something like this and right now I'm facing this problem.

I have this as a code:

`

{{member.name}}
    </paper-dropdown-input>

`

And when I click the dropdown it immediately shows 'No Results Found' and no items are shown. Only when I type something on the input do the items appear. But even then the items are shown as

[object Object]. How do I fix this?

Juravenator commented 7 years ago

I think you got very close, and it seems your use case closely resembles the custom template demo, so you could look there for answers:

3 things to consider:

With these 3 changes, and provided members resembles something like [{name: "something"}, {name: "something else"}], you should be good to go with this code:

<paper-dropdown-input label="Members" items="[[members]]" filter-property="name">
  <template>
    <dom-repeat items="[[items]]" as="member">
      <template>
        <paper-item>{{member.name}}</paper-item>
      </template>
    </dom-repeat>
  </template>
</paper-dropdown-input>

Please let me know if you have any luck with this.

michael-learns commented 7 years ago

@Juravenator Yes! That works perfectly. Btw, is there anyway I can get the selected value and pass it to a function when I on-tap a button?