Reputation: 4059
Let's suppose I have this this simple button:
{
xtype :'button',
text :'button',
id:'address'+counter.no,
handler : function() {}
}
How can I get access to the current button and get access to its properties such as name, id, etc?
I'm aware of Ext.getCmp('compid')
but I need to get access to CURRENT button, and I don't know its id
.
Upvotes: 2
Views: 4164
Reputation: 4273
Do you mean inside the handler function?
See docs at description for handler
.
As first parameter this
button object is passed, so you could do the following:
{
xtype :'button',
text :'button',
id:'address'+counter.no,
handler : function(thisButton, eventObject) {
//Do something with thisButton like:
alert(thisButton.getId());
}
}
Upvotes: 6