Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha Premium Member
    Join Date
    Nov 2008
    Posts
    102
    Vote Rating
    1
    scaswell1 is on a distinguished road

      0  

    Default AccordionPanel add error

    AccordionPanel add error


    Hello,

    When attempting to add a ContentPanel to an AccordionLayoutContainer, I get the following error:

    Code:
    java.lang.AssertionError: Method must be called before the widget is rendered
    	at com.sencha.gxt.widget.core.client.Component.assertPreRender(Component.java:1197)
    	at com.sencha.gxt.widget.core.client.ContentPanel.setCollapsible(ContentPanel.java:543)
    	at com.sencha.gxt.widget.core.client.container.AccordionLayoutContainer.onInsert(AccordionLayoutContainer.java:305)
    	at com.sencha.gxt.widget.core.client.container.Container.insert(Container.java:400)
    	at com.sencha.gxt.widget.core.client.container.InsertResizeContainer.insert(InsertResizeContainer.java:27)
    	at com.sencha.gxt.widget.core.client.container.Container.add(Container.java:88)
    It seems that when adding a child to an AccordionLayoutContainer, the add method makes sure the child is collapsible, which is apparently only allowed during pre-render. This severely inhibits the ability to add items to an accordion layout container dynamically. Any hints?

  2. #2
    Sencha User
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    Is it possible that your ContentPanel was already used somewhere else before and so it was already attached once?

    Currently there is a check in place for this. However in GXT 3 this also might be possible to be a runtime change that should always be possible. I will move this thread to the bugs forum for investigation.

  3. #3
    Sencha Premium Member
    Join Date
    Nov 2008
    Posts
    102
    Vote Rating
    1
    scaswell1 is on a distinguished road

      0  

    Default


    Hi Sven,

    I am sure that the ContentPanels being added are brand-new.
    Pseudo code for my use case is as follows:

    Code:
    Viewport v = new Viewport();
    v.setWidget(new BorderLayoutContainer());
    v.getWidget().setWestWidget(new AccordionLayoutContainer());
    RootPanel.get().add(viewport);
    
    // ... some processing goes on ...
    
    for (some_item in some_list) {
         ContentPanel newPane = ... // processing of some_item results in a new panel
        v.getWidget().getWestWidget().add(newPane);
    }
    I can try to make a testcase for you at some point today, if you would like.

  4. #4
    Sencha User
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    OK, as workaround, can you try to add the viewport after your precessing?

  5. #5
    Sencha Premium Member
    Join Date
    Nov 2008
    Posts
    102
    Vote Rating
    1
    scaswell1 is on a distinguished road

      0  

    Default


    Yeah, if I add the panels before adding the Viewport to the RootPanel, everything works fine. It was just inconvenient, not as much as a show stopper (in this use-case, anyway.)

Thread Participants: 1