mardi 24 février 2015

[4.2] Custom Component fire event when click in a tpl link

Hello!

I have a custom component with a link into a html tpl, i need when i click in this link the component fire an event to i listen in the controller.


code:



Code:



...
tpl: [
'<div class="title center"><p>{title}</p></div>',
'<div class="content center">',
'<div class="number center"><h1>{qtd}</h1></div>',
'<div class="ind left">',
'{ind}',
'</div>',
'</div>',
'<div class="more">',
'<a href="#" class="clickme">See all...</a>',
'</div>'
],
...

I've tryed to create listener with delegation but i cant get the component scope into the listener.


Code:



..
listeners: {
// Add the listener to the component's main el
el: {
delegate: '.clickme',


click: function(ev, li) {
// need to fire event in component here
}
}
},
...

the event needs to be fired in the "clickme" class.



[4.2] Custom Component fire event when click in a tpl link

Aucun commentaire:

Enregistrer un commentaire