Questions tagged [backbone-events]

This is for backbone.js questions that specifically relate to Backbone's event handling system.

Docs

787 questions
0
votes
1 answer

Re-inject Backbone.View into the DOM with keeping events instead of creating new events

I got following example Backbone.View: var View = Backbone.View.extend({ tagName: "div", className: "advertisement", initialize: function () { this.on('switch', this. switch, this); this.views = {}; this.views.laptop = new…
bodokaiser
  • 15,122
  • 22
  • 97
  • 140
0
votes
1 answer

Backbone JS: Routes with empty parameters

I have a route. routes: { "example/=q:query": "example_main" } This: localhost/site/#example/q=hello works perfectly but if the URL is: localhost/site/#example/q= My router does not understand it and no action is performed. Does anyone know…
0
votes
1 answer

Events not captured

I built a chrome extension for the Github Star page using jQuery and Backbone. You can try it here: https://chrome.google.com/webstore/detail/gpmgjficglcobhpbbkbgklfcpmhpemnb and the source code is here: https://github.com/gregorym/galactic My…
Gregory
  • 557
  • 6
  • 17
0
votes
1 answer

Backbone.ModelBinder: why do I have to hit submit twice?

I am using Backbone and Backbone.ModelBinder. I have a bunch of text fields that are bound via BackboneModelBinder. Everything works as expected however when I make a change to a text field and I don't unfocus the field first (click off the input…
Kirk
  • 1,521
  • 14
  • 20
0
votes
1 answer

Backbone view inside other view by ajax. Events not working

I have Backbone view. It load content (component on backbone with AJAX): render: function () { var self = this; $.get('/Blog', request, function (data) { self.$el.html(data); …
0
votes
2 answers

Backbone events hash with collections

Im trying to utilize Backbone's view events hash to bind a change event to the current view's collection: events: { 'this.collection change': 'render' } as opposed to my current method: initialize: function() { this.collection.on('change',…
0
votes
3 answers

Render a view for a model on first load, not on every change

I would like to render a view for a model when the model is first fetched but not on every change. My setup is as follows: var m = new $.model.Customer({id: customer}); var v = new $.view.GeneralEditView({el: $("#general"), model:…
Conor Power
  • 686
  • 1
  • 6
  • 17
0
votes
1 answer

listening to changes in Backbone.js

I'm trying to understand when to use events in the view vs in the models or collections. From what I understand now: events in the UI that made by the user - should be in the view's "event" method. for listening to changes in the model and…
Daniel
  • 1,562
  • 3
  • 22
  • 34
0
votes
3 answers

Backbone.js Click Event Won't Fire

I have been trying to learn backbone.js, but I can't figure out why my click event isn't firing when I click the home link. I'm fairly new to backbone and I'm just not sure what am I missing? I've looked up a bunch of different tutorials on the…
Jason Biondo
  • 736
  • 5
  • 16
  • 34
0
votes
2 answers

Execute a function after two or more events are fired in Backbone

I have two buttons:
I want to make an alert message to appear only after the two buttons are clicked, this is part of a larger app for which I am using Backbone.js, so far I…
rpabon
  • 1,191
  • 2
  • 16
  • 22
0
votes
2 answers

DOM manipulation on window resize with Backbone Events

I have a client side app I'm working in which Im' using jQuery 1.7.x, Backbone and Underscore. The app has many columns and as the window is resized I need to adjust the DOM to push or pop a column. I'm running into an issue of how to manipulate…
yekta
  • 3,363
  • 3
  • 35
  • 50
0
votes
1 answer

Apply jQuery function on an 'el' of backbone.js to get the value of its children

I'm really new to backbone so the question may seem a bit naive. But I'm trying to figure out how to apply jQuery on an 'el' to get the value of an input. Basically I have a form, and I want whenever the user makes some change to an input, the…
danqing
  • 3,348
  • 2
  • 27
  • 43
0
votes
1 answer

Backbone Model.set Not Sticking?

In my backbone app I have a View backed by a Model and I'm storing the models in a Collection. There are several of these views on the page and only one can be selected at a time. Therefore, I have another View that contains a collection of these…
threejeez
  • 2,314
  • 6
  • 30
  • 51
0
votes
1 answer

How should Backbone listen for file upload?

I wrote a single button file upload using a hidden iframe and javascript to submit the form. I'm trying to get backbone to listen for when it is successful so I can create a new div for the image to be inserted onto the page but I am fairly new to…
user965749
  • 45
  • 7
0
votes
1 answer

How can i append a view to existing html markup using backbone.js

Can anybody give a small example about how to load a new div container based on a mouse click, using Backbone.js? I would like to add a new div container to my already existing html contents.
JeanFrancois
  • 134
  • 3
  • 7