PDA

View Full Version : Portlet Vertical Resize combined with Maximize is acting up.



CrazyEnigma
4 Dec 2009, 1:27 PM
I'm combining this Portlet code with maximize code, just wanted to know if anyone knows the problem that I am facing. The resizing shims are off in nowhere. On maximize, should I be turning off resizing, and how can I fix the resizing so it's not preventing the maximize?

Maximize works if I don't resize using the resizer. Here is how I get there:

Resize the Portlet.
Maximize the Portlet. - This is where the shims are off, and the maximize is cut off.
Restore the Portlet to view other portlets in the portal - The shims are not in the right location.
This code as taken from http://www.extjs.com/forum/showthread.php?t=22788&highlight=resizing+portlet and added it to the Portlet code.

Am I missing code in the minimize/maximize to get resizer to position properly.



canResize: true,
transparent:false,
animate: false,
onRender : function(ct, position) {
Ext.ux.Portlet.superclass.onRender.call(this,ct,position);

var createProxyProtoType=Ext.Element.prototype.createProxy;
Ext.Element.prototype.createProxy=function(config){
return Ext.DomHelper.append(this.dom, config, true);
};

if(this.canResize==true) {
this.resizer = new Ext.Resizable(this.el, {
animate: this.animate,
handles: 's',
transparent:this.transparent,
minHeight: this.minHeight || 100
});
this.resizer.on('resize', this.onResizer, this);
}
Ext.Element.prototype.createProxy=createProxyProtoType;
},
onResizer : function(oResizable, iWidth, iHeight, e) {
this.setHeight(iHeight);
},




var minimizeTool = {
id:'minimize',
hidden:true,
qtip: 'Minimize Panel',
handler: function(e, target, panel)
{
panel.tools['toggle'].setVisible(true);
panel.tools['maximize'].setVisible(true);
panel.tools['minimize'].setVisible(false);
panel.tools['close'].setVisible(true);
panel.ownerCt.columnWidth = panel.ownerCt.originalColumnWidth;
panel.setSize(panel.originalSize);
panel.setHeight(panel.originalHeight);
var p = panel.nextSibling();
while (p != null)
{
p.show();
p = p.nextSibling();
}
p = panel.previousSibling();
while (p != null)
{
p.show();
p = p.previousSibling();
}
var c = panel.originalOwnerCt.nextSibling();
while (c != null)
{
c.columnWidth = c.originalColumnWidth;
c.show();
c = c.nextSibling();
}

c = panel.originalOwnerCt.previousSibling();
while (c != null)
{
c.columnWidth = c.originalColumnWidth;
c.show();
c = c.previousSibling();
}
panel.draggable = true;
panel.ownerCt.ownerCt.doLayout(false);
}
};
var maximizeTool = {
id:'maximize',
qtip: 'Maximize Panel',
handler: function(e, target, panel)
{
// Resize Columns

panel.originalOwnerCt = panel.ownerCt;
panel.originalSize = panel.getSize();
panel.originalHeight = panel.getInnerHeight();

var p = panel.nextSibling();
while (p != null)
{
p.hide();
p = p.nextSibling();
}
p = panel.previousSibling();
while (p != null)
{
p.hide();
p = p.previousSibling();
}
var c = panel.originalOwnerCt.nextSibling();
while (c != null)
{
c.originalColumnWidth = c.columnWidth;
c.columnWidth = 0.01;
c.hide();
c = c.nextSibling();
}

c = panel.originalOwnerCt.previousSibling();
while (c != null)
{
c.originalColumnWidth = c.columnWidth;
c.columnWidth = 0.01;
c.hide();
c = c.previousSibling();
}

// Set the column width to 1.0
panel.ownerCt.columnWidth = 1.0;
panel.draggable = false;
panel.tools['toggle'].setVisible(false);
panel.tools['maximize'].setVisible(false);
panel.tools['minimize'].setVisible(true);
panel.tools['close'].setVisible(false);

panel.setWidth(panel.ownerCt.ownerCt.getWidth());
panel.setHeight(panel.ownerCt.ownerCt.getHeight() - 55);
panel.ownerCt.ownerCt.doLayout(false);
}
};

CrazyEnigma
16 Dec 2009, 9:31 AM
I am looking towards the more veteran folks to help me out on this. Please point me in the right direction. I have been working on this problem for a long time now, and I don't know how to solve it.

I tried to disable the Resizable object on maximize and I thought that maybe the onResizer function is firing, but I don't get a message returned when I add an alert or a console.info.

I really need help on this solution, and I promise to post the fixed code of the Extended portlet when I am finished.