listbox - Need to access the MULTIPLE (possible) Selected Options -


i have constructed "listbox" in html using select & option tags , single selections working expected inside respective polymerelement.

however, when enable mutiple options multiple=true attribute turned on expected values of top most selectindex , value passed me in option_selected() "lifecycle" method.

i have found multiple solutions involving jquery , js, nothing have tried has worked dart-polymer. (the straight js solution found not access variables.)

the html/polymer code (inside tag) looks this:

    <select  multiple=true style="width:250px;" selectedindex="{{selected}}" value="{{value}}" size="8" on-click="{{option_selected}}" on-change="{{on_change}}" >                   <option template repeat="{{dataele in dataar}}" > {{dataele}} </option>     </select>   

the preferred solution dart or polymer-dart.

thanks!

you selected values way:

@observable var values = toobservable(<string>[]);   void on_change(event, details, element target) {   var el = (shadowroot.queryselector('select') selectelement);    var v = <string>[];   el.options.foreach((o) => o.selected ? v.add(o.value) : null);   values.clear();   values.addall(v); } 

just show selected values on page

<template repeat="v in values">   {{v}} </template> 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -