Hey guys!
I'm trying to build a grid layout component that takes a template and a data array and renders the provided data into a grid layout. The usage is somewhat similar to that of the core-list component:
<grid-layout data="['one', 'two', 'three']" cols="2">
<template>
<div>{{ }}</div>
</template>
</grid-layout>
The problem that I'm facing now is that any event handlers added declaratively to the template are not being registered. So this won't work:
<polmer-element name="x-test">
<template>
<grid-layout data="['one', 'two', 'three']" cols="2">
<template>
<div on-tap="{{ itemTapped }}">{{ }}</div>
</template>
</grid-layout>
</template>
<script>
Polymer({
itemTapped: function() {
alert("An item was tapped!");
}
});
</script>
</polymer-element>
I think the reason for this is that unlike the core-list element I'm not using the template as-is but instead remove it from the light dom, put it into another template and then add that template to the light dom. The content is being stamped out just fine but apparently the on-tap handler is not being registered. I think I understand why this happens, the question is: Is there a way to make it work?
Any help would be greatly appreciated!
Best,
Martin