View Full Version : ItemTPL

17 Dec 2012, 11:28 AM
Added a delete and edit button to my itemtpl. Wanting to listen for clicks on selectionchange.

If (evt.getTarget('#deleteBtn'){
console.log("button was clicked inside selectionchange")

Error has not method getTarget

18 Dec 2012, 3:35 AM
The selectionchange event for a view isn't passed the underlying DOM event, so wherever you're getting evt from it's unlikely to be correct.

From what little information you've provided I'd say that you'd be better off attaching a single click listener to the view itself and using a delegate to pick up the buttons. See the docs here for details on delegate:


I'd also advise avoiding the use of ids such as 'deleteBtn', use a CSS class instead.