PDA

View Full Version : how to add a click event to extjs autoel?



extremed
3 Jan 2012, 7:53 AM
Hi

If i add a button like this


xtype: 'component',
autoEl: {
html: '<input type="submit" class="custom_loginbtn" value="Submit" id="login"/>'
}

any idea how to add a click event to this ?

also how to use the extjs button tpl config?

Regards

mitchellsimoens
3 Jan 2012, 7:59 AM
{
xtype : 'component',
autoEl : {
html : '<input type="submit" class="custom_loginbtn" value="Submit" id="login"/>'
},
listeners : {
el : {
delegate : 'input',
click : function() {
console.log('click');
}
}
}
}

The delegate config is the magic maker there. It tells the click event to only fire on that DOM selector, in this case on any input tag.

extremed
3 Jan 2012, 8:13 AM
Thanks a lot :)