destroy dummycomponent for panel
In the below pulgin, when I minimize the panel , I also want to destroy the dummy panel component. I have added this line to minimize handler, this.dummyComponent.destroy();
But i still get an object in panel.dummyComponent when i try to maximize the panel for second time. is there any way i can get rid of this dummy component and recreate it everytime I maximize the panel.
Code:
Ext.ux.MaximizeTool = function() {
this.init= function(ct) {
var maximizeTool = {
id: 'maximize',
handler: handleMaximize,
scope: ct,
qtip: 'Maximize'
};
ct.tools = ct.tools || [];
var newTools = ct.tools.slice();
ct.tools =newTools;
for(var i=0, len=ct.tools.length;i<len;i++) {
if (ct.tools[i].id=='maximize') return;
}
ct.tools[ct.tools.length] = maximizeTool;
};
function handleMaximize(event, toolEl, panel){
panel.originalOwnerCt = panel.ownerCt;
panel.originalPosition = panel.ownerCt.items.indexOf(panel);
panel.originalSize=panel.getSize();
if (!toolEl.window) {
var defaultConfig = {
id: (panel.getId() + '-MAX'),
width: (Ext.getBody().getSize().width - 100),
height: (Ext.getBody().getSize().height - 100),
resizable: true,
draggable: true,
closable: true,
closeAction: 'hide',
hideBorders: true,
plain: true,
layout: 'fit',
autoScroll: false,
border: false,
bodyBorder: false,
frame: true,
pinned: true,
bodyStyle: 'background-color: #ffffff;'
};
toolEl.window = new Ext.Window(defaultConfig);
toolEl.window.on('hide', handleMinimize, panel);
}
//alert(panel.dummyComponent);
if (!panel.dummyComponent) {
var dummyCompConfig = {
title: panel.title,
width: panel.getSize().width,
height: panel.getSize().height,
html: ' '
};
panel.dummyComponent = new Ext.Panel(dummyCompConfig);
}
toolEl.window.add(panel);
if (panel.tools['toggle']) panel.tools['toggle'].setVisible(false);
panel.tools['maximize'].setVisible(false);
panel.originalOwnerCt.insert(panel.originalPosition, panel.dummyComponent);
panel.originalOwnerCt.doLayout();
panel.dummyComponent.setSize(panel.originalSize);
panel.dummyComponent.setVisible(true);
panel.dummyComponent.getEl().mask('This is maximized.');
toolEl.window.show(this);
};
function handleMinimize(window) {
this.dummyComponent.getEl().unmask();
this.dummyComponent.setVisible(false);
this.originalOwnerCt.insert(this.originalPosition, this);
this.originalOwnerCt.doLayout();
this.setSize(this.originalSize);
this.tools['maximize'].setVisible(true);
if (this.tools['toggle']) this.tools['toggle'].setVisible(true);
this.dummyComponent.destroy();
}
};
Possible to use in TabPanel?
Has anyone had success with this UX in a tab panel? Out of the box implementation inserts a new blank tab on minimize instead of adding the maximized grid back into the tab it was originally contained in.
Data missing when we close the panel
hi,
Panel maximize is working for me. but If I click the close button the panel . panel closed and the data are missing.
Thanks,
Raja S