Reputation: 533
I'm Student with EXTJS4..
I added Ext.Img to AbsolutePanel, and I set the Position.
And after, I Changed Ext.Img's Position, Like this.
img.x = 30;
But He no Change his Position.
What can i do for this Problem?
This is my Code..
Ext.Img..
var paddleItem1 = {
xtype : 'image',
src : "lib/Image/Paddle.png",
x : 0,
y : 0,
draggable : true,
index : 0,
id : 'paddleItem1',
dx : 2,
dy : 2,
name: 'rightPaddle',
type: 'Paddle',
color : '255,0,0',
w : 100,
h : 100,
hid : 'paddleItem1'
};
And this is AbsolutePanel.
var centerRegion = Ext.create('Ext.form.Panel', {
title : 'Center Region',
region : 'center',
layout : 'absolute',
margins : '5 5 0 5',
id : 'designSpace'
});
And this is Add Item to AbsolutePanel.
centerRegion.add(paddleItem);
Last, This is Change Position Code
centerRegion.items.items[0].x = 30;
Upvotes: 0
Views: 1385
Reputation: 30082
Use the setPosition method:
Ext.onReady(function() {
var vp = Ext.create('Ext.container.Viewport', {
layout: 'absolute',
items: {
title: 'Foo',
x: 10,
y: 10,
width: 100,
height: 100
}
});
setTimeout(function() {
vp.items.first().setPosition(30, 30);
}, 1000);
});
Upvotes: 1