Question:

Question:

we have,

newItem = CurrentContainer.cloneItem(existingItem);

is there a way to use it from a panel-container to clone an item from parent-container?

This could make my RollClock script probably 70% smaller.

]]>

17 Commentsto Question:

  1. Anonymous says:

    < ![CDATA[

    I am not sure of what you need, but cloneItem works on any item and you can get the parent container using Item.getParent(). From there you should be able to clone anything you need.

    ]]>

  2. Anonymous says:

    < ![CDATA[

    wouldn’t the newly cloned item be in/partof the parent container?

    ]]>

  3. Anonymous says:

    < ![CDATA[

    Yes, I realize only now that there is no “moveItem” function.

    ]]>

  4. Anonymous says:

    < ![CDATA[

    pfew! I feared i missed something obvious 😉

    ]]>

  5. Anonymous says:

    < ![CDATA[

    That can be fixed for the next update!


    Container.moveItem(Item item, Container to_other_container)

    ]]>

  6. Anonymous says:

    < ![CDATA[

    This is critical: The ID of an item depends on the container it is in. Will it change the ID or remain with an inconsistent ID?

    ]]>

  7. Anonymous says:

    < ![CDATA[

    I guess it will change. The same as when changing it from lightning menu. I guess the function will return the new item. I don’t see any critical problem.

    ]]>

  8. Anonymous says:

    < ![CDATA[

    Absolutely. References to the old item should be replaced with the item returned by the function.

    ]]>

  9. Anonymous says:

    < ![CDATA[

    var tItemC = Tcont.cloneItem(tItem);


    var newItem = Tcont.moveItem(tItemC, dc);


    newItem.setCell(0, 0, 1, 1, true);




    results in



    cannot setCell of null



    Is can see tItemC in container dc



    am I using it wrong?

    ]]>

  10. Anonymous says:

    < ![CDATA[

    I can confirm the bug.


    The item is duplicated and moved to the container correctly. But the function returns null

    ]]>

  11. Anonymous says:

    < ![CDATA[

    Yes, my bad, I just saw this.

    ]]>

  12. Anonymous says:

    < ![CDATA[

    ok, i can wait. Thanks.

    ]]>

  13. Anonymous says:

    < ![CDATA[

    Confirmed working in v12.5.1.


    Thanks!

    ]]>

  14. Anonymous says:

    < ![CDATA[

    eeeum… was I wrong expecting that the copied item kept its properties after a clone and move to a panel?

    ]]>

  15. Anonymous says:

    < ![CDATA[

    If the properties are not specific they can change. I mean, the container have default properties, so if the item has the default setting it will have the default setting in the other container…and it can be different.

    ]]>

  16. Anonymous says:

    < ![CDATA[

    are you sure? I will upload a screenshot, suggesting different.

    ]]>

  17. Anonymous says:

    < ![CDATA[

    I didn’t tested, so maybe I’m wrong.


    An screenshot will be fine 🙂

    ]]>

Leave a Reply

Your email address will not be published. Required fields are marked *