Polymer 1.0 cannot find events for paper-menu or paper-item -


upgrading polymer 1.0, how listen/capture change in "focuseditem" of iron-menu-behaviour? cannot see event or property change listener item change i.e. change in paper-item selection within paper-menu. cannot see such events here: https://elements.polymer-project.org/elements/iron-menu-behavior?active=polymer.ironmenubehavior

i have not been able find documentation on yet (perhaps else may have better luck), events looking iron-select , iron-deselect. both of these events use handler format: eventhandler(e, details), in which:

  • e customevent.
  • details object item property pointing element selected or deselected.

i've set demo on plunker can play around with. has sample menu , log both e , details both iron-select , iron-deselect events console.

that being said, however, if able avoid using event , instead use bindings, recommend route first. if within custom element, could, example, do:

<dom-module id="my-custom-element">   <template>     <div>       <span>[[selectedmessage]]</span>       <span>[[oldselectedmessage]]</span>     </div>     <paper-menu selected="{{selectedindex}}">       <paper-item>this item #0</paper-item>       <paper-item>this item #1</paper-item>       <paper-item>this item #3</paper-item>     </paper-menu>   </template> </dom-module>  <script>   polymer({     is: 'my-custom-element',     properties: {       selectedindex: {         type: number,         value: 0,         observer: '_selectedindexchanged'       }     },     _selectedindexchanged: function(newindex, oldindex) {       if (typeof newindex === 'number') {         this.selectedmessage = 'you selected item #' + newindex + '.';       }       if (typeof oldindex === 'number') {         this.oldselectedmessage = 'before, had item #' + oldindex + ' selected.';       }     }   }); </script> 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -