I'm a former Flex dev, and one of the things I liked about their list-based components was the concept of item renderers. In Flex, item renderers are components whose job is to visualize data for components such as lists, dropdowns, trees, etc.
I am trying to build my own custom tree element in Polymer. So far I've successfully created one that properly displays an object tree as a series of indented text labels. What I would like is to be able to have an attribute on my custom element called itemRenderer that would contain the the tag name of different custom element. I've tried several ways to use this attribute within the tree's template to create a tag with that name with some success. What follows is a simplified form of what I initially thought would work...
<template repeat="{{item in items}}">
<template if="{{itemRenderer}}">
<{{itemRenderer}} item="{{item}}"></{{itemRenderer}}>
</template>
</template>
However the result was the being displayed as text as if the > and < entities were used.
I had better success by creating the renderer elements during the domReady event and manually putting them with appendChild into a placeholder div. One problem with this solution was that when the items array was modifed, such as another object being added, the template repeat would create another placeholder, but nothing would trigger the creation of the additional renderer element. I created an itemsChanged method on my element, but quickly realized that it would be a lot of work to determine exactly how the array of items had changed.
I've attached a zip of the actual source. It contains all of the Polymer code as well. I'm sorry if that isn't the norm; this is my first post here. The index.html shows the one instant of the custom element being used to display a tree of labels and a second trying to use an item renderer.
Thanks for your help.
- Paul