Reputation: 11125
I don't understand if anything is wrong in this idea but the Backbone Views just don't trigger keypress, keyup events. I have created a simple shopping list app is JsBin for you to inspect. In the chrome inspector the ul
of the view shows the keyup event but it does not occur when i hit some keys in the keyboard. I need the idea to navigate Treeview using the keyboard events
http://jsbin.com/arucom/2/edit
Upvotes: 2
Views: 5071
Reputation: 11003
In addition to the question @rkw linked You might want to have a look at this SO question Why audio events are not firing with BackboneJS but others are?
Basically backbone.js uses delegation to bind events, which only works with delegate-able events.
You can bind to the keypress manually in the initializer
initialize: function () {
_.bindAll(this);
$(document).bind('keyup', this.navigate);
},
Upvotes: 7