PDA

View Full Version : Scope of element click event



simon
14 Oct 2016, 12:59 AM
I add button to accordionPanel title. When button is clicked, I would like to call function from base component.
How can I set the scope for el.on('click') event? Or access cmp from that event?
Can someone explain?




afterrender: function (c) {
var cmp = this;
var el = c.header.insertFirst({
tag: 'input',
type: 'button',
value: 'edit'
});
el.on('click', function (e, t) {
//I would like to access cmp but it is not accessible
cmp. //is null
});
}