Repeater inside a repeater.

edited November 2013 in Newbie Questions
Hey. I am using enyo 2.3 and I am trying to use a repeater inside a repeater. I read a discussion about it but could not understand the conclusion so I put it up again. Here is my code (which matters)
{
            name: "dashboardRepeater",kind: "Repeater",onSetupItem:"setupItem",classes: "panel-home",components: [
                {
                    kind: "Scroller",
                    name:"repeaterItem",
                    onScroll: "reposition",
                    classes:"dashboard-item",
                    ontap: "dashboardChangeview",
                    components:[
                        {name:"dashContent",
                          components:[
                                { name: "dashboardSectionName",classes:"dashboardSectionNames"},
                                {name: "dashboardSectionUpdate", classes: "dashboardSectionUpdates"},
                                {name:"dashboardSectionList",kind: "List",onSetupItem: "setupList",components:[
                                        {  name:"dashboardsubsectionTitle" },
                                        { name: "dashboardSectiontext", allowHtml: true,classes: "dashboardSectiontext"}
                                    ]
                                },
                           ]
                        },
                    ]
                }
            ]
        }

create: function() {
        this.inherited(arguments);
        if(dashboardList.length > 0){
            this.$.dashboardRepeater.setCount(dashboardList.length);
        }
    },
setupItem: function(inSender, inEvent) {
        var index = dashboardList[inEvent.index];
        var item = inEvent.item;
        item.$.dashboardSectionName.setContent(dashboardConfig[index].title);
        item.$.dashboardSectionUpdate.setContent(dashboardConfig[index].update);
        item.$.dashboardSectionList.setCount(dashboardConfig[index].text.length);
    },

setupList: function(inSender, inEvent){
        var index = inEvent.index;
        var item = inEvent.item;
        return true;
    },
I wanted to understand how can I refer the elements of the child repeater(dashboardsubsectionTitle, dashboardSectiontext) as inEvent.item in no longer a property. They only way I found was inEvent.flyweight.bindingTransformOwner.componente[0].dashboardsubsectionTitle and others.

Any advice?

Thank you

Comments

  • Be sure to also return true from setupItem -- that will prevent the internal onSetupItem event from propagating out during creation.

    I'd suggest making a separate kind for the inner items and having event handling at that level instead of trying to have multiple repeaters in the same components tree.

Sign In or Register to comment.