Ahmed Farahat
Ahmed Farahat

Reputation: 2443

Polymer iron-select fires on element load

i have a paper-dropdown-menu inside a repeating template, this dropdown have an on-iron-select event, problem is the event fires for each element being binded on the element load, how can i prevent this.

<paper-dropdown-menu label="Status" required >
   <paper-menu selected="{{item.status}}" id="ddlStatus" attr-for-selected="value" on-iron-select="_statusChanged"  class="dropdown-content">
      <template is="dom-repeat" items="{{statusList}}">
         <paper-item value="{{item}}">{{item}}</paper-item>
      </template>
   </paper-menu>
</paper-dropdown-menu>

Upvotes: 4

Views: 966

Answers (2)

Ankit Kante
Ankit Kante

Reputation: 2139

You solution will not work.iron-activate seems to be called when you open the selector and not on selecting a new option from the dropdown list. Suppose, your current selected option was 'Status1' and you selected Status2. If you use iron-select, the value you'll get from event.target.selected is Status2. But,if you use iron-activate, you'll get the old selected value Status1.

Upvotes: 1

Ahmed Farahat
Ahmed Farahat

Reputation: 2443

After struggling for hours i found a solution, which is not to use on-iron-select event and use on-iron-activate instead, this will only fires when an item is selected and will not fire while the drop-menu is being populated and default item set to it

Upvotes: 3

Related Questions