dontbugme
24 Aug 2011, 4:15 PM
I am working on a page where I am trying to move components which belong to a panel which has an absolute layout. It kind of works if I manipulate the component's element top/left, but as it is manipulated further, and as more items are added to the container dynamically, the layout gets screwed up. I thought I'd try setting the x and y properties on the component itself and letting the layout manager worry about positioning, but I can't seem to get it to work. It looks as if calls to the container's doLayout() does not update positioning.
Here's a code sample which shows a symptom of what I am running into:
<html>
<head>
<title>Area Chart Tips Bug</title>
<link rel="stylesheet" type="text/css" href="ext-4.0.5/resources/css/ext-all.css" />
<script type="text/javascript" src="ext-4.0.5/bootstrap.js"></script>
<script type="text/javascript">
Ext.require(['*']);
Ext.onReady(function () {
Ext.create('Ext.panel.Panel', {
width: 1000,
height: 1000,
title: 'Border Layout',
layout: 'border',
items: [{
title: 'Center Region',
region: 'center', // center region is required, no width/height specified
xtype: 'panel',
layout: 'absolute',
items:[{
xtype: 'button',
text: 'Click me',
x: 50,
y: 50,
handler: function(){
if(this.moved === true){
this.panel.x = 800;
this.panel.y = 800;
this.ownerCt.doLayout();
}
else{
this.panel = {
xtype: 'panel',
x: 300,
y: 300,
movable: true,
width: 95,
height: 105,
title: 'adsf'
};
this.moved = true;
this.ownerCt.add(this.panel);
}
}
}]
}],
renderTo: Ext.getBody()
});
});
</script>
</head>
<body>
</body>
</html>
This little example has a button that when clicked the first time will spawn an absolutely positioned panel. Clicking it a second time will change the panel's x and y values and call doLayout on the parent container. I'd expect this to move the panel to its new coordinates but it does not work. Am I doing something wrong, or is this a bug?
Here's a code sample which shows a symptom of what I am running into:
<html>
<head>
<title>Area Chart Tips Bug</title>
<link rel="stylesheet" type="text/css" href="ext-4.0.5/resources/css/ext-all.css" />
<script type="text/javascript" src="ext-4.0.5/bootstrap.js"></script>
<script type="text/javascript">
Ext.require(['*']);
Ext.onReady(function () {
Ext.create('Ext.panel.Panel', {
width: 1000,
height: 1000,
title: 'Border Layout',
layout: 'border',
items: [{
title: 'Center Region',
region: 'center', // center region is required, no width/height specified
xtype: 'panel',
layout: 'absolute',
items:[{
xtype: 'button',
text: 'Click me',
x: 50,
y: 50,
handler: function(){
if(this.moved === true){
this.panel.x = 800;
this.panel.y = 800;
this.ownerCt.doLayout();
}
else{
this.panel = {
xtype: 'panel',
x: 300,
y: 300,
movable: true,
width: 95,
height: 105,
title: 'adsf'
};
this.moved = true;
this.ownerCt.add(this.panel);
}
}
}]
}],
renderTo: Ext.getBody()
});
});
</script>
</head>
<body>
</body>
</html>
This little example has a button that when clicked the first time will spawn an absolutely positioned panel. Clicking it a second time will change the panel's x and y values and call doLayout on the parent container. I'd expect this to move the panel to its new coordinates but it does not work. Am I doing something wrong, or is this a bug?