Get Multiple Values Of Selected Paper-radio-button
I have a dom-repeat element that creates a paper-radio-group with a couple of paper-radio-buttons. These radio-buttons each contains two pieces of unique information loaded from an
Solution 1:
Use selected-item
and add a conditional attribute for each value (model
and price
) onto the paper-radio-button
element:
<paper-radio-group class="layout vertical" selected-item="[[selectedItem]]">
<template is="dom-repeat" items="[[models]]" >
<paper-radio-button name="{{item.model}}" model$="[[item.model]]" price$="[[item.price]]"><span>[[item.model]]</span> <div class="paper-font-caption"><span>[[item.price]]</span> SEK</div></paper-radio-button>
</template>
</paper-radio-group>
<paper-item><span>[[model]]</span></paper-item>
<paper-item><span>[[price]]</span></paper-item>
Then setup an observer to monitor changes to selectedItem
and set the two values you want to capture as follows:
...
observers: [ '_selectedItemChanged(selectedItem)' ],
_selectedItemChanged: function(el) {
this.price = el.getAttribute('price');
this.model = el.getAttribute('model');
},
...
Post a Comment for "Get Multiple Values Of Selected Paper-radio-button"