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

Refreshing backbone form (including events) after validation error without reloading page

I have a Backbone view with a form. When the user submits a form there can be a validation error, that is handled by the backend. After I display the error, I want the form to be usable again. I thought I should just do this.delegateEvents(), but…
Stpn
  • 6,202
  • 7
  • 47
  • 94
0
votes
2 answers

Prevent backbone event from firing

I have a basic form with a backbone view, when I press enter on the top input the open event is fired. How can I ensure that the open event only fires when I press the browse button?
marcus
  • 9,616
  • 9
  • 58
  • 108
0
votes
1 answer

Binding to Route Events in a View

If I bind to a router event in the initialize method, the callback is called: var View = Backbone.View.extend({ initialize: function() { router.on("route:test", this.update); }, update: function() { console.log('This…
Steve
  • 53,375
  • 33
  • 96
  • 141
0
votes
1 answer

Backbone view to re-render if any other view gets rendered

I have a TooltipView that pops up whenever an element with class .tooltip is moused-over and takes the content of that elements data-tooltip attribute and displays it in the tooltip. I bind the events for TooltipView in it's initialise function but…
barro32
  • 2,559
  • 23
  • 36
0
votes
2 answers

Backbone view's "delete" button is deleting all elements from the collection as opposed to the targeted element only

EDIT1: I have tried many different strategies for deleting the element including this.model.destroy(), this.collection.remove(this.model), etc. I have also bound the events using the events: syntax and using a direct binding strategy in both…
stevekane
  • 372
  • 1
  • 10
0
votes
1 answer

Backbone.js and Bootstrap Typeahead - rendering after async fetch

I took the base of this code from a gist. It initially worked perfectly when I first fetch()ed the collection and then in render() called tw-bootstap's .typeahead(). However, I have put in a keypress event to try and restrict the size of the data…
Joe
  • 1,841
  • 4
  • 27
  • 43
0
votes
1 answer

In Backbone, how to replace view's model once model is destroyed?

I have a Backbone view that renders a calendar, which in turn renders a sub-view for each day. Each day has a single model and a single click event that either selects or de-selects the day. If a day is selected, the model is saved, and if it's…
Justin Stayton
  • 6,031
  • 8
  • 37
  • 43
0
votes
1 answer

How to handle Backbone events implementing a google.maps.OverlayView?

My Backbone view implements a google.maps.OverlayView(). This view contains a few div's for content and I need to handle mouseover/out on the container div and click events on two containing div's. The only way I'm able to get the needed events is…
devployment
  • 2,121
  • 1
  • 22
  • 33
0
votes
1 answer

Backbone.js fetch issues with Google Maps

With backbone I am fetching results from Google maps to return markers of places where the user is. The results populate a collection which I clear everytime the user moves the map as a new fetch occurs based on the new location bounds (I am using…
Clawg
  • 349
  • 2
  • 4
  • 18
0
votes
0 answers

Backbonejs events syntax on objects

Suppose that I have the following view: var SampleView = Backbone.View.extend({ initialize: function() { this.child_element = this.$('#new-catalog>button:first'); }, events: { 'click…
pistacchio
  • 56,889
  • 107
  • 278
  • 420
0
votes
1 answer

backbone model validation error

I got a validation based on backbone fundamentals by addyosmani, but when i try it on my view i can't get the error that the model generated.TIA model.js validate: function(attrs) { var errors = this.errors = {}; if…
koko
  • 31
  • 2
  • 6
0
votes
1 answer

Backbone.js view events registered but not firing

Just getting started here and cannot seem to get this very basic thing working. All my elements render as I expect. My events register in firefox in the "events" tab, but none of them seem to fire (click, mouseover, etc). I am using the…
Matt Broekhuis
  • 1,985
  • 2
  • 26
  • 35
0
votes
0 answers

Backbone.js event always activated

Possible Duplicate: Javascript , event handler is always called, even if the event is not raised I'm new to Backbone.js and I have an issue with an event. In my appView.js, I have just this : var languagesView = new app.LanguagesView(); And this…
Johann
  • 447
  • 2
  • 8
  • 23
0
votes
1 answer

Backbone reset event firing before fetch complete, and collection empty

The following code makes it look as if the "reset" event on the AccItemList collection is firing before the fetch is complete. The output to the console for this is as follows... rendering 0 fetched 0 ... so "render" is called before there are any…
centralscru
  • 6,580
  • 3
  • 32
  • 43
0
votes
0 answers

id is not copied as a direct property in Backbone when set it in attributes hash

In Backbone document, it says that: If you set the id in the attributes hash, it will be copied onto the model as a direct property. But it does not work on my code: var room = new Room({id: 1}); test.equals(room.id, 1);// expect room.id to be 1,…
aqingsao
  • 2,104
  • 1
  • 19
  • 18