core-list on-core-activate gets undefined object on nested template

101 views
Skip to first unread message

Hans Dulimarta

unread,
Oct 7, 2014, 3:04:01 PM10/7/14
to polym...@googlegroups.com
I have been looking for answer to the following problem with core-list and on-core-active handler.

My core-list is as follows:
<core-list data="{{myarr}}" on-core-activate="{{rowSelected}}">
 
<ol>
   
<template>
     
<li>{{text}}      /* (1) handler works here */
     
<ul>
       
<template repeat="{{options}}">
         
<li>{{}}</li>    /* (2)   handler does not work here */
       
</template>
     
</ul>
   
</template>
 
</ol>
</core-list>



my source array is :

myarr = [
 
{text: "Question 1",
   options
: ["Opt a", "Opt b", "Opt c"]},
 
{text: "Question 2",
   options
: ["Opt a", "Opt b", "Opt c"]},
  ...
];



and the handler function is:
rowSelected: function(evt, dtl, snd) {
   
// dtl.item and dt.data show correct value when (1) was tapped
   
// dtl.item and dt.data are undefined when (2) was tapped
   
}


The HTML output is rendered correctly but event handling is not what I expect to see.
Tapping on the list item generated by the outer template (marker (1) above) works fine, but tapping on the list item from the inner template (marker (2) above) gives undefined object on dtl.data and dtl.item inside the rowSelected function.

What am I missing here? If I can't use core-list for this purpose, what are my other options?
Thanks

gree...@gmail.com

unread,
Oct 8, 2014, 7:03:59 AM10/8/14
to polym...@googlegroups.com
Hi

Looks like a bug in core-list component - here is my attempt at fixing it: https://github.com/Polymer/core-list/pull/35

Reply all
Reply to author
Forward
0 new messages