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?

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.

I was having same problem adding ContentPanel to AccordionLayoutContainer in GXT 3.1.1.I debug the code and it looks like the ContentPanel was attached before the setCollapsible method of it was called so pre-render assertion fail raise.
This method of AccordionLayoutContainer:

The issue occurs when adding a content panel on to the accordion after it's rendered. To dynamically fix this, the accordion would have to be removed from parent, rebuilt and then re-added which would render it with the new panel. In other words we don't currently support adding it once its rendered, but have support for rebuilding and adding it.

At the moment I don't have any workarounds b/c the assertion happens in the component.