bcx-aurelia-reorderable-repeat
bcx-aurelia-reorderable-repeat copied to clipboard
Crushes when used together with custom attribute that overrides context
This works:
<div reorderable-repeat.for="item of items">
#${item.id} ${item.value}
</div>
But this crushes with node.getAttribute is not a function error:
<div reorderable-repeat.for="item of items" with.bind="item">
#${id} ${value}
</div>
Standard repeat works:
<div repeat.for="item of items" with.bind="item">
#${id} ${value}
</div>
With "with.bind" (another template controller), the view factory works differently. I can get rid of the error, but unfortunately cannot yet get reordering working. Need to study on au's view factory more.
This is the same issue as repeating on template element. https://buttonwoodcx.github.io/doc-bcx-aurelia-dnd/reorderable-repeat/limitations
With "with.bind" (a template controller), aurelia uses a template to render, which delays the rendering. The reorderable-repeat logic only sees the template, not the rendered dom element.
@bigopon could you help to have a look here? reorderable-repeat needs to play with the rendered dom to register dnd event handlers. https://github.com/buttonwoodcx/bcx-aurelia-reorderable-repeat/blob/8195b44bf680156f571da7c3960235a0aff65f12/src/reorderable-repeat.js#L566
But when using with a template element (or another template controller), the view.firstChild is not yet populated. However the view.viewFactory.template is there but that's not the final rendered dom element. Is there a way for me to wait and access the rendered dom element from a (nested) template controller?