-
27 Feb 2013 7:01 AM #1
AccordionPanel add error
AccordionPanel add error
Hello,
When attempting to add a ContentPanel to an AccordionLayoutContainer, I get the following error:
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?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)
-
27 Feb 2013 7:26 AM #2
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.
-
27 Feb 2013 7:44 AM #3
Hi Sven,
I am sure that the ContentPanels being added are brand-new.
Pseudo code for my use case is as follows:
I can try to make a testcase for you at some point today, if you would like.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); }
-
27 Feb 2013 9:58 AM #4
OK, as workaround, can you try to add the viewport after your precessing?
-
27 Feb 2013 10:04 AM #5
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.)
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote