PDA

View Full Version : Problem in constrainTo configuration in Panel



arvindwill
18 Jan 2013, 4:13 PM
In a code extended Ext.panel.Panel for a floating panel. When derived class for the panel rendering is working fine including the dragging. But "constrainTo" configuration is not working if added from the creating object code for the class.

var workspaceDom=Ext.get('sworkspace');
var shape =Ext.create('ClassPath', {
constrainTo:workspaceDom
});

In the corresponding class file.

constructor: function()
{
this.callParent(arguments);
},

Added callparent in the constructor. When analysing the resulting object in the firebug it has constrainTo property in the object variable but not working as per required. Is there any mistake?

mitchellsimoens
21 Jan 2013, 11:26 AM
So I have this class and it works for me:


Ext.define('MyPanel', {
extend : 'Ext.panel.Panel',
xtype : 'mypanel',

draggable : true,
floating : true,
width : 400,
height : 400,
title : 'Test',

constructor : function() {
this.callParent(arguments);
}
});


new MyPanel({
renderTo : document.body,
constrainTo : document.body
});

I cannot drag it outside the body

vnggui
17 Oct 2013, 1:42 PM
I'm interested about this topic.
If I create a panel and drag it, can get drag event to know the position of the panel, like top,left,width and height?

Thanks,

vng