lundi 21 décembre 2015

Polymer 0.5 core-selector-how to get selected values with paper-checkbox

I have a list of paper-checkbox elements inside a core-selector like this

<core-selector id="moduleSelector"  multi="true" valueattr="label" notap?="{{true}}" on-core-select="{{selectionSelect}}>
   <template repeat="{{modules in moduleslist}}">
    <core-label horizontal layout>
        <paper-checkbox  id="modulecheckbox" checked="{{modules.checked}}" label="{{modules.pname}}" 
        on-change={{checkboxHandler}} noink></paper-checkbox>
    </core-label>
    <br>
 </template>
</core-selector>

I wish to get the array of selected paper-checkbox labels using this.$.moduleSelector.selected but i get only some index values which are not accurate as per the module list indexes.I need to get the label names.

If I use paper-items instead of checkboxes like below

<core-selector id="moduleSelector" valueattr="label" multi="true" notap?="{{false}}">
  <template repeat="{{modules in moduleslist}}">
    <paper-item label="{{modules}}"></paper-item>
  </template>
</core-selector>

then I can get the proper array values using this.$.moduleSelector.selected

Any help will be appreciated.




Aucun commentaire:

Enregistrer un commentaire