backbone.js - Can't get backbone view to respond to events added by this.on() -


i want listen event/s in view, after processing (to specific, respond these events after successful ajax call - working, it's event stuff can't figure).

because of this, using events property isn't going achieve i'm after.

i'm new backbone , @ loss problem this.on('click'...) code below (backboneclicked() not fire).

i have included events property below put in test , fires ourclick(). jqueryclicked() fires.

am missing obvious?

i know there lots of other questions views not firing events, couldn't see matched question.

any appreciated.

var inputlistview = backbone.view.extend({     el: '#input-list',      events: {         'click input'       : 'ourclick'     },      initialize: function(options) {                  this.$el.click(this.jqueryclicked);          this.on('click', this.backboneclicked);     },      ourclick: function(e) {         alert('ourclick');     },      backboneclicked: function(e) {         alert('backboneclicked');     },      jqueryclicked: function(e) {         alert('jqueryclicked');     } }); 

this.on('click', this.backboneclicked);

what behavior expect have? can't click on view, it's object, not dom element... though if want test if works, try add this.trigger('click') after line.

still, don't point here. if you're using on method of backbone, you're trying listen backbone events (or custom events), not ui events.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -