Animal
1 Aug 2010, 5:08 AM
If you want a Component to be removed from the DOM, but kept for use later, then use this plugin.
Child Components which are removed and not destroyed (See API docs!!!), are moved into a hidden Container.
/**
* <p>Plugin for the Container class which causes removed (but not destroyed)
* Components to be removed from their place in the DOM, and put into "cold
* storage" in a hidden Container.</p>
* <p>Removed Components may be re-added to other Containers later.</p>
*/
Ext.ns("Ext.ux");
Ext.ux.ContainerClear = new function() {
var bin,
afterRemove = function(comp, autoDestroy) {
if(!this.autoDestroy || (autoDestroy === false)) {
if (!bin) {
bin = new Ext.Container({
id: 'x-bin-container',
cls: 'x-hidden',
renderTo: document.body
});
}
bin.add(comp);
bin.doLayout();
}
};
this.init = function(ctr) {
ctr.remove = ctr.remove.createSequence(afterRemove);
};
};
Ext.preg('container-clear', Ext.ux.ContainerClear);
usage:
plugins: 'container-clear',
Child Components which are removed and not destroyed (See API docs!!!), are moved into a hidden Container.
/**
* <p>Plugin for the Container class which causes removed (but not destroyed)
* Components to be removed from their place in the DOM, and put into "cold
* storage" in a hidden Container.</p>
* <p>Removed Components may be re-added to other Containers later.</p>
*/
Ext.ns("Ext.ux");
Ext.ux.ContainerClear = new function() {
var bin,
afterRemove = function(comp, autoDestroy) {
if(!this.autoDestroy || (autoDestroy === false)) {
if (!bin) {
bin = new Ext.Container({
id: 'x-bin-container',
cls: 'x-hidden',
renderTo: document.body
});
}
bin.add(comp);
bin.doLayout();
}
};
this.init = function(ctr) {
ctr.remove = ctr.remove.createSequence(afterRemove);
};
};
Ext.preg('container-clear', Ext.ux.ContainerClear);
usage:
plugins: 'container-clear',