I am trying to create panel in ext js and got success on that but I also want to add click event with this
{
xtype: 'panel',
flex: 1,
x: 10,
y: parseInt(panelCreation[i - 1].y) +
parseInt(panelCreation[i -1].height) + 10,
width: twidth,
height: theight,
layout: 'absolute'
}
I don't want to add click event separately I want to add with this code like after layout:absolute add comma and event please help me in this.
You can add in the following for a click event:
listeners: {
'render': function(panel) {
panel.body.on('click', function() {
alert('onclick');
});
}
}
EDIT: to get the X and Y coordinates of the click event you can change the click event handler as follows...
panel.body.on('click', function(e) {
alert('X: ' + e.getPageX());
alert('Y: ' + e.getPageY());
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With