This is for backbone.js questions that specifically relate to Backbone's event handling system.
Questions tagged [backbone-events]
787 questions
5
votes
1 answer
Highlight selected item with backbone router callbacks
The Application Layout
I have an application, with a sidebar that holds many items and a main div which displays these items. There is also a simple Backbone.Router, a ItemsCollection and a Item model. I've got a SidebarView for the sidebar and a…

iblue
- 29,609
- 19
- 89
- 128
5
votes
2 answers
Getting backbone.js to run a function after constructing a Collection?
I may be completely missing something here, but I have the following:
a Model which encapsulates 'all' the data (all JSON loaded from one URL)
the model has one (or more) Collections which it is instantiating with the data it got on…

Joe
- 46,419
- 33
- 155
- 245
5
votes
1 answer
Triggering an event on el in Backbone View
I have a view that creates and populates a Selectlist. I want to bind an event on the Change event (When the user selects a different Option.
It simply outputs something close to this:

Hyper
- 312
- 4
- 13
5
votes
1 answer
Preventing backbone zombie views
Note: we are using backbone 1.0.0
I am relatively new to Backbone, and was going to through some of the code a ex co-worker wrote. Rather than copy pasting stuff blindly, I wanted to understand how he did things, and that's when I started wondering…

iDesi
- 692
- 1
- 10
- 19
5
votes
1 answer
backbone click events not firing
I am not sure why this is happening. This looks very unusual to me.
Generally when i want an action to be performed on a button click i will use this
events:{
'click #button_name':'somefunction'
},
somefunction: function(){
alert("Blah");
}
But…

seshan
- 99
- 2
- 11
5
votes
3 answers
Backbone: firing an event only once on a Collection 'change'
Simple question: What is the best way to fire an event 'only once'?
I have a Collection in backbone with multiple models. Sometimes multiple models' attributes are updated at once, firing multiple 'change' events on the Collection.
What is the best…

Dan0
- 459
- 3
- 16
5
votes
3 answers
select2-selecting event not getting fired
I am using Select2 in my website, and I'm trying to use the select2-selecting event, but its not firing. I am also using Backbone.js in the app, so the first thing I tried was adding the select2-selecting to my events object:
// 'change…

coder
- 10,460
- 17
- 72
- 125
5
votes
1 answer
Collection add event listener in Backbone
I am trying to update my view whenever I add a new model to my collection. My first question is do I automatically add a model to my collection when I save that model, like:
PostsApp.Views.Form = Backbone.View.extend({
template:…

s_curry_s
- 3,332
- 9
- 32
- 47
5
votes
1 answer
Backbone.js Router doesn't fire on page init
i have a quite simple backbone router and everything works fine so far. Except when i reload/direct enter the url i.e. http://mydomain.com/#list/50fadc41125b0
I've tried nearly everything now without any positiv results at all.
myRouter =…

Horst
- 407
- 5
- 17
5
votes
2 answers
Backbone: add event listener only if doesn't already exist
In other words: how do I find list of events already being listened to?
I'm using Backbone.on(... and Backbone.trigger(... to communicate between two Views that don't know about each other. However, the View that adds the listener is really an…

yar1
- 1,331
- 2
- 15
- 26
5
votes
1 answer
How To Find Triggered Event From Backbone.listenTo?
In Backbone, I'm using the new Backbone.listenTo event. One of my instances has the listener attached to three different events e.g.:
this.listenTo(this._Collection, 'reset add change', this._setCollection);
It is called appropriately when it's…

Brandon
- 1,399
- 4
- 20
- 37
5
votes
1 answer
Backbone scroll event not firing
Backbone scroll event will not fire. The click event and jquery attached scroll works. Here's a fiddle as well: http://jsfiddle.net/cX2UV/
js
var TView = Backbone.View.extend({
events: {
'scroll .content': 'loadMore',
…

ryan
- 6,541
- 5
- 43
- 68
5
votes
2 answers
Getting event names when using .on() for multiple events on a Backbone collection.
How do I know what event is triggered on a Backbone collection when binding multiple events to it using .on()? See the following example for clarification. (Also see the jsFiddle: http://jsfiddle.net/PURAU/3/)
var Car = Backbone.Model.extend({
…

Benny Johansson
- 761
- 6
- 18
5
votes
1 answer
How do I add a resize event to an article in backbone?
events:
'click textarea': 'composeComment'
'click .submit': 'submit'
'blur textarea': 'textareaBlur'
'resize article': 'repositionBoards'
repositionBoards: ->
#this is my own function, i just need it to be called everytime an…

wedep.java
- 51
- 1
- 2
5
votes
1 answer
Backbone view event not firing - not sure why
I'm trying to get the click event to fire, but it's not working. Maybe someone can see something I can't.
ConnectionView = GlobalView.extend({
tagName: 'div',
events: {
"click .social-links": "check"
},
initialize:…

xil3
- 16,305
- 8
- 63
- 97