Bindings on child objects

I have a model object that has a hasOne relationship to its owner. (a conversation and a contact). I'm trying to bind the contact's name in a DataList without any luck:

{kind: "enyo.DataList", name: "conversationList",
fit: true,
controller: ".app.controllers.conversations",
childBindingDefaults: {source: ".model", to: ".content"}, components: [
{bindings: [{from: ".subject"}]},
{bindings: [{from: ""}]}, //Doesn't work
{bindings: [{source: "", from: ".name"}]}, //Doesn't work
{bindings: [
{from: ".contact", to: ".contact"},
{source: ".contact", from: ".name", to: ".content"}
]} //Does work, but too verbose
Is this a bug or just the way the bindings work? Also, I've chopped and renamed stuff, so the code may have some typos


  • edited August 2013
    I'd expect that your first one with from: "" would work. We'll have to dig into this.

    Does it work if you use DataRepeater?
  • It doesn't work using DataRepeater. The bindings are "firing" - by the time it gets to getSourceValue, binding.source is set to the controller, and binding._sourceProperty is set to "name". The "contact" part seems to be lost.

    During Binding.initPart, this.source has been resolved, so it skips most of the logic for calculating the root + path - it's not until this section where binding._sourceProperty is set:

    // if we don't know our actual root property to bind on we
    // grab that as well
    if (!this[rp]) {
    this[rp] = parts.pop();
    At that time, 'parts' is an array ["contact", "name"], so calling pop() returns "name". The array is locally scoped and not used after that.

    Hopefully that helps save some time troubleshooting it.
  • Thanks for the information @ericmartineau, I'll look into this.
  • ...and just merged in Cole's fix for that. Hope it works for you.
Sign In or Register to comment.