You are viewing documentation for Vaadin Framework 8 and related products View documentation for Vaadin Framework 7 ›
Item Events · Vaadin
Vaadin Elements - Context Menu - Item Events

Item Events

In order to handle menu item events, such as click or tap, use Polymer on-[replaceable]#event# annotations to setup listeners in your component (my-list-view):

<dom-module id="my-list-view">
  <template>
    <vaadin-context-menu>
      <template>
        <paper-menu>
          <paper-item on-tap="_appendItem">Append item</paper-item>
        </paper-menu>
      </template>

      <ul>
        <template is="dom-repeat" items="[[items]]">
          <li index="[[index]]">[[item]]</li>
        </template>
      </ul>
    </vaadin-context-menu>
  </template>

  <script>
    Polymer({
      is: 'my-list-view',

      properties: {
        items: {
          type: Array,
          value: function() {
            return ['Foo', 'Bar', 'Baz'];
          }
        }
      },

      _appendItem: function() {
        this.push('items', 'New item');
      }
    });
  </script>
</dom-module>

<my-list-view></my-list-view>