i try to implements this example this into polymer since i need to display label's into input.
i just tried
- html :
<div id='comp' class="item">
<form id="formC">
<div class="item-label edit">
<iron-ajax url="/url" last-response="{{resp}}" auto></iron-ajax>
<vaadin-combo-box id="Box" name="Box" selected-item="{{label}}"
placeholder="Please select" items="[[resp]]" item-value-path="label"
item-label-path="label" value$='[[data.label]]' name='label' >
</vaadin-combo-box>
</div>
<div class="item-valu edit">
<input size="8" name="valu" value$='[[data.valu]]'>
</div>
</form>
</div>
- script
ready(){
const combobox = Polymer.dom(this.root).querySelector('vaadin-combo-
box');
combobox.items = [
{label: 'One', nilai: 1},
{label: 'Two', nilai: 2},
{label: 'Three', nilai: 3}
];
combobox.addEventListener('selected-item-changed', function() {
alert("selected-item-change" + JSON.stringify(combobox.selectedItem));
});
combobox.addEventListener('value-changed', function() {
alert("value-change" + combobox.nilai );
});
}
on combobox addEventListener
there's an error Uncaught TypeError: Cannot read property 'addEventListener' of null
but the error is from queryselector
update 1. : querySelector success with Polymer.dom(this.root).querySelector
update 2. : still not understood why combobox.nilai 'undifined'
update 3. : it works combobox.selectedItem.nilai ^^ thx god, thx everyone .. now i just need to inject the value