PDA

View Full Version : Best way to get click event on template?



mitchellsimoens
16 May 2010, 4:54 PM
I have a template and part of that template I want to capture the click event. The way I am doing it now is that I get all elements with the class name and then add the click event to it:


var test = document.getElementsByClassName("album-delete");
for (var i=0; i<test.length; i++) {
Ext.get(test[i]).on("click", function() {
alert("Click");
});
}

Is this the best way? My first time using Ext.XTemplate so I'm not sure if there is a better way.