enyo.Repeater inside Repeater


I have one Repeater nested in another one. The second level one is initiated from "onSetupItem" of the first. The second one in it's "onSetupItem" have index of 0 all the time. Any tips ?

Thanks, Jacob


  • edited May 2013
    Make sure you're returning true from the second onSetupItem handler so the event doesn't bubble back up to the first.

    edit ... tried it out in jsfiddle and saw the same behavior ... investigating ...
  • edited May 2013
    found it! there's a bug in enyo.OwnerProxy in which the parent instance overrides the index with its index value.


    Bug filed
  • Fixed
    Thanks a lot!

    FYI - this "Fixed" version seems to work fine with Enyo 2.2.0 !
    But with latest nightly build version it again does not work.
  • @Martin, I've got a version that works with the latest nightly build. There were two things that resulted in it not working:

    1) Enyo now checks to ensure a kind is not being overridden by kind name alone, so when it determined that a kind with the name already existed, it put a halt to the creation of the modified kind
    2) With the latest code on the master branch (and in the nightly build), there is delegation code inside of the enyo.OwnerProxy kind. As such, the event wasn't being delegated to the proper Repeater. That's fixed in the code I put together based on Ryan's code.

    You can see my version at http://jsfiddle.net/arthurthornton/DPmNZ/ for the fixed code that should work.
  • @arthur - thanks for adaptation of this fix to latest code version !
    Looking forward to Enyo 2.3 update. :)
  • There's a philosophical issue with this, though... what should index be for a sub-repeater sending onSetupItem? The fix makes it more obvious, but it means your onSetupItem handler for the inner repeater doesn't know the top-level index in which it lives.

    In general, I'd want to solve this by not having nested repeaters in one kind but instead factoring out the inner controls to a new kind which would then be repeated.
  • OK, fix is committed to master. I decided to preserve inner index value, but give access to the other levels through a new indices array property.
  • Thanks, switched to 2.2.0 temporarily, will check master as well.
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!