Repeater Bound To JSON

edited May 2014 in Enyo 2.4
Do I have the binding container in the right place? I can't seem to get this Json to bind to this repeater.

enyo.kind({
name: "App_0_0_2",
kind: "FittableRows",
classes: "enyo-fit",
style: "background-color: #000;",
components:[
{ kind: "Scroller", name: "siteWrapper", fit:true, components: [
{ kind: "SiteHeader", title: "X", flows: "0", activeSwitches:"0", links:"0" },
{ kind: "FittableColumns",
components: [
{content: "1", classes:"detail-label",
components: [
{ name: "details", fit:true, tag:"div", classes:"detail-label", content: "", components: [
{kind: "Signals", onCitySelected: "citySelected"},
{kind: "Signals", onCityDeselected: "cityDeselected"}
]},
{ tag:"span", style:"font-size:18px;color:#fff;clear:both;margin:25px;", content:"Instances" },
{ kind: "Repeater", name:"instanceRepeater", components: [
{ name:"item", classes:"repeater-sample-item", components: [
{ kind: "onyx.Button", name:"Instance", style:"margin:25px; clear:both; display: block;", net:"#004775" }
]}
], bindings: [
{ from: ".model.desc", to: ".$.Instance.content" },
]}
],
bindings: [
{from: ".collection", to: ".$.instanceRepeater.collection"}
]},
{content: "2", fit: true, style:"overflow:hidden;",
components: [
{ kind: "Scroller", name: "d3", fit:true, style:"border: solid #fff 1px;" },
]},

Comments

  • I mean the line {from: ".collection", to: ".$.instanceRepeater.collection"} is that at the right place?
  • The binding paths for from and to are relative to the component on which they're defined. In general, that means you'll define them on the kind and not on a component within the components block. The notable exception is the for DataRepeater and DataList in which you define them bindings on the top-most child control (in other words, the repeated control).
    enyo.kind({
        name: "MyKind",
        bindings: [
            // all the bindings go here
            {from: ".collection", to: ".$.repeater.collection"}
        ],
        components: [
            // components
            {name: "repeater", kind: "DataRepeater", components: [
                {kind: "onyx.Item", components: [
                    // controls
                ], bindings: [
                    // bindings for the row model to the row controls
                ]}
            ]}
        ]
    });
  • yet again, you prove your weight in gold. Thanks man!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!