Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    How to remove and add portlets correctly?

    Hello,

    I have a problem when I want to delete portlets from a portalLayout to add new ones. First, here is how I delete the portlets (after a click on a button):

    Code:
    for (Canvas c: getPortalLayout (). getChildren ()) (
                getPortalLayout (). removeChild (c);
                c.destroy ()
            )
    I think i am removing portlets well (I hope). Then I add my portlets with this function :

    Code:
    getPortalLayout (). addPortlet (portlet);
    So when I run it, all the portlets are deleted but then none are added. And the most weird is that when I remove the piece of code to remove portlets, adding works well (but of course I keep the portlets already present).

    So here I am a bit lost, my code to delete portlets is good or not? If someone has already encountered this problem I'm all ears.

    Thank you very much.

    #2
    You should be using add/removePortlet() not removeChild(), and by the way removing should cause destroy anyway. Otherwise if you run into another issue, will need to see more code to know you are doing it correctly or not.

    Comment

    Working...
    X