These are chat archives for canjs/canjs

5th
Dec 2016
Juan Orozco
@Macrofig
Dec 05 2016 15:13
Question on removal of elements...
{{#if dataColumns.length}}
    <c3-wrapper>
      <bit-c3-data type="donut">
        {{#each dataColumns}}
          <bit-c3-data-column value="{.}" />
        {{/each}}
      </bit-c3-data>
    </c3-wrapper>
{{else}}
    <p>No results</p>
{{/if}}
if datacolumns is set to empty array, I would expect bit-c3-data-column to be removed first, then bit-c3-data, then, finally c3-wrapper. But in reality, it is bit-c3-data-column, c3-wrapper, bit-c3-data.
This sounds like a bug to me but I'm not sure how to debug this in can.stache to verify
btw, this is 2.3 using (obivously) the bit-c3 component
cc @kylegifford @phillipskevin
Viktor Busko
@Lighttree
Dec 05 2016 15:23
can-component inserts it's content into root tag <my-component> Is there any way to replace it with content ? so root will be my inner wrapper without <my-component> tag.
Juan Orozco
@Macrofig
Dec 05 2016 15:25
I don't believe so but maybe? For sure you could use can.view.attr to achieve this. https://v2.canjs.com/docs/can.view.attr.html
can-component uses can.view.tag which I don't believe works that way: https://v2.canjs.com/docs/can.view.tag.html
Viktor Busko
@Lighttree
Dec 05 2016 15:29
ok thanks, that not really big issue, will look for another way to solve my issue.
Juan Orozco
@Macrofig
Dec 05 2016 15:31
It kinda makes sense, too. You are talking about de-encapsulating the component, essentially. There's a way to do it (move html after template is done rendering) but at that point we need ask why component is a good solution. I suggest can.view.attr and can.control combo. Maybe someone else has better solution?
Kevin Phillips
@phillipskevin
Dec 05 2016 15:33
why do you want to replace the component with the content @Lighttree?
@Macrofig does the same thing happen without bit-c3?
if you just set up your own components
Juan Orozco
@Macrofig
Dec 05 2016 15:37
@phillipskevin Good call. Lemme try that.
Kevin Phillips
@phillipskevin
Dec 05 2016 15:38
also, how are you listening to remove events
Juan Orozco
@Macrofig
Dec 05 2016 15:44
in component declaration using removed
Kevin Phillips
@phillipskevin
Dec 05 2016 16:24
so it does remove in the weird order?
Juan Orozco
@Macrofig
Dec 05 2016 16:24
yea
But only if the components are inserted by a "wrapper" component. If I insert the template I mentioned above using .html the elements remove in the correct order
Let me rephrase that... the template above... if it is inserted as the template of yet another component, then the remove order is incorrect.
If I insert the template manually using .html, then the remove order is correct.
Kevin Phillips
@phillipskevin
Dec 05 2016 16:27
ok
interesting
but I have no idea if that’s incorrect
maybe ask on the forums? or if it’s breaking something, go ahead and submit an issue.
Juan Orozco
@Macrofig
Dec 05 2016 16:31
Gotcha. Thanks!