i’m Dongju and Study extjs4.
I wanna return Click target’s variable.
When I click the Ext.Img, I wanna get the Image’s config. (e.g. x, y, Image, and so on)
How to get right Information?
this is my code
var paddleItem = {
xtype : 'image',
src : "lib/Image/Paddle.png",
x : 0,
y : 0,
draggable : true,
index : 0,
id : 'paddleItem',
name : 'Paddle',
width : 100,
height : 100,
listeners : {
click : {
element : 'el',
fn : function(e,t,eOpts) {
alert(t.toString());
}
}
}
};
w
I believe at the point your click function is executed ‘t’ will be the target of the click event and of type HTMLElement (According to the ExtJS API).
To get the x/y from that, you can probably use something like offsetWidth/Height if you need the position of the HTML element containing the Ext image on the page.
Alternatively, if you need properties of the var paddleItem in the click function, could you not use something like this:
That way you’d have a reference to the Component, rather than the HTML element and could call methods on it directly.