lundi 29 février 2016

Polymer 0.5: paper-checkbox issue

I have a paper-checkbox inside a template repeat as below

<core-selector id="moduleSelector" valueattr="label" notap?="{{true}}">
  <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>

Initially I fill this with some modules. Its an object with properties checked and pname.

Now after the list is populated, i get some entries dynamically and I add them like moduleslist.push(obj) where var obj={pname:"abc",checked:true}. When I do this I get an error as below

polymer.js:4887 Exception caught during observer callback: TypeError: Cannot read property 'checkbox' of undefined. This happens at paper-checkbox.html line 92- var cl = this.$.checkbox.classList; in function checkedChanged

The result is that the checkbox is unchecked but added to the list.

This might be an issue with polymer 0.5 as its an unstable version, I know the new one might have this fixed. But I am hoping to find a temporary solution/workaround to my problem as I can't do an upgrade at this stage of my work.

Thanks !




Aucun commentaire:

Enregistrer un commentaire