-
10 Dec 2008 9:45 AM #1
[2.2][CLOSED] Removing panel from Accordion layout leaves undead panel html in dom
[2.2][CLOSED] Removing panel from Accordion layout leaves undead panel html in dom
The code is in this thread over in ext:help:
http://extjs.com/forum/showthread.php?t=54759
I tested on Firefox 3.x and IE 7.x - same behavior, which is:- Have a basic panel with an accordion layout containing two or more panels.
- Remove one of the panels and add another, calling doLayout like everyone tells you to.
- Click on Accordion panel headers to minimize them all, and be amazed to find the panel you removed in a ghost-like state where its header only sometimes respects being visible in the accordion layout while expanding and collapsing other members of the panel.
-
10 Dec 2008 11:38 PM #2Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 41
This is not a bug:
1. Removing a component from a container without destroying it won't remove the component from the DOM. Either hide the component or move the component element to another place in the DOM.
2. Destroying a component (e.g. while removing it from a container) will invalidate the component, so it can't be reused. You will have to recreate the component before you can add it to a container again.
-
11 Dec 2008 4:57 AM #3
If what you're saying is true, then you've a problem.
If removing a component without refreshing the DOM has the effects it does, why do you offer the remove function with the [Boolean autoDestroy] argument? Obviously, anyone setting autodestroy to false is going to get the same ghosting of components that I'm getting, so the question is: Is the behaviour of not removing the component from the DOM the bug, or is the public remove function with the autoDestroy argument the bug?
-
11 Dec 2008 5:01 AM #4Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 41
As I already said:
You have 2 options if you remove a component from a container without destroying it:
1. Hide the component (your example should be using this option).
2. Move the component to a different location in the DOM (e.g. when moving a component from one container to another).
-
11 Dec 2008 2:27 PM #5
Condor is spot on, the reason why the autoDestroy option is there is that you may wish to reuse the component at some point. Since you're explicitly setting autoDestroy to false, we're going to assume you will either:
a) Hide it yourself
b) Add it to another containerEvan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
4 Mar 2009 11:17 AM #6
SO if you hide it before calling remove it should work correctly once you add and show it elsewhere?
-
4 Mar 2009 11:31 AM #7Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 41
That depends on the layout of the new container. Some layouts will move the component element to the new location, but some won't (in which case you will have to do it yourself).


Reply With Quote