Questions tagged [backbone-events]

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

Docs

787 questions
7
votes
2 answers

Showing, Hiding, then re-showing Layouts breaks Events

Having trouble showing, hiding, and then re-showing Marionette Layouts. I believe this problem also applies to regular Backbone Views and Marionette ItemViews as well though. In summary, I have a parent view. When it is initialized, it creates two…
Chris Dutrow
  • 48,402
  • 65
  • 188
  • 258
7
votes
1 answer

Backbone.js model's destroy method does not trigger success or error event

I am beginning to learn Backbone.js and I started with this boilerplate and made an example by loading JSON data from a static file on disk and display it in an html table. Then I tried to bind an event on a button which is supposed to delete an…
MaxiWheat
  • 6,133
  • 6
  • 47
  • 76
6
votes
1 answer

Backbone events on model firing on collection (Double firing)

A Backbone app which I'm developing has a collection and a model, and associated views for each item. https://gist.github.com/2255959 When I click on the PostView, unexpectedly, the event fires on the collection without any wiring. I figured I'd…
RandallB
  • 5,415
  • 6
  • 34
  • 47
6
votes
2 answers

In backbone.js how do I bind a keyup to the document

I've been following along with a Railscast tutorial of backbone.js and I wanted to extend the functionality to include keyboard control. I added the following to my show view: class Raffler.Views.EntryShow extends Backbone.View template:…
map7
  • 5,096
  • 6
  • 65
  • 128
6
votes
2 answers

Event binding clicks with backbone.js & jQuery

I need to bind two events in my backbone.js-view in order to toggle a menu. The idea is that if a button with the id #toggler is clicked the menu appears and any click outside the #menu element will hide the menu. Unfortunately I cannot get this…
Industrial
  • 41,400
  • 69
  • 194
  • 289
6
votes
2 answers

Backbone.js: How do I force the View to automatically refresh when changing a models collection

So I have a View that looks like this. //base class var SelectListView = Backbone.View.extend({ initialize: function() { _.bindAll(this, 'addOne', 'addAll'); this.collection.bind('reset', this.addAll); …
ctrlShiftBryan
  • 27,092
  • 26
  • 73
  • 78
6
votes
2 answers

Backbone listenTo multiple attributes firing multiple events

I have a Model which in the initialize function I have the following code: this.listenTo(this, 'change:re change:read', this.patch); The patch function looks like this: patch: function(object) { this.save(object.changed, { patch: true…
David
  • 363
  • 3
  • 14
6
votes
3 answers

Catching remove event on View in Backbone js

Is there any way to listen to remove/destroy event on the Backbone View.? I want to do some thing like as below: $(myBackboneView).on('remove', function () { // do some processing }); or $(myBackboneView).on('destroy', function () { // do…
Rahul Bhanushali
  • 553
  • 5
  • 14
6
votes
3 answers

Backbone - View is triggering mouseout event even tho it's inside the root.

With the backbokne.js, mouseover and mouseout events of a view don't work as I'm expecting: Red part (root class div) is the parent of the inner div named info-box. When moving the mouse from root to the info-box, it triggers a 'mouseout' event…
Hellnar
  • 62,315
  • 79
  • 204
  • 279
6
votes
2 answers

Backbone.js - fetch method does not fire reset event

I'm beginning with Backbone.js and trying to build my first sample app - shopping list. My problem is when I fetch collection of items, reset event isn't probably fired, so my render method isn't called. Model: Item = Backbone.Model.extend({ …
chr1s
  • 135
  • 1
  • 4
  • 8
6
votes
4 answers

Backbone.marionnette - Rebinding events vs creating new view

I have a Layout that has several tabs. Clicking one of these tabs will show the appropriate composite view in the page's content region. After navigating back and forth between different tabs I noticed that the composite views have lost their native…
user1473339
6
votes
1 answer

How to handle google maps events in jasmine test framework

I am trying to write Javascript tests for Google Maps using the jasmine framework. What I am trying to do is initiate the map and change the bounds (zoom out) and test that the map was correctly zoomed out. The problems I am encountering are that…
Mr.B
  • 917
  • 1
  • 11
  • 20
6
votes
2 answers

Backbone.js sync event in collection

According to doc here: http://documentcloud.github.com/backbone/#FAQ-events collection has sync event fired when I do something to sync collection with server. I try to invoke fetch method on collection and wait for sync event on it, but it never…
Karol Sikora
  • 522
  • 1
  • 4
  • 11
5
votes
1 answer

Backbone.js - Temporarily disabling (events in) View

TL;DR How to temporarily disable a View so I can safely load another View, then safely close the loaded View to return to the original View? I have the following scenario: User opens /search which loads SearchView. User clicks a button to perform…
wiradikusuma
  • 1,930
  • 4
  • 28
  • 44
5
votes
2 answers

How to find the Id of model corresponding to clicked item?

How to know the Id of item I clicked? my code is given below: $(function() { ipl.mvc.view.openings_view = ipl.mvc.view.view_base.extend({ template: '/assets/t/plmt/companies.tmpl.html', ID: '#tmpl_openings', events: { "click…
Venkatesh Bachu
  • 2,348
  • 1
  • 18
  • 28