Questions tagged [backbone-views]

Views in the Backbone.js library. Backbone views are used to reflect what your applications' data models look like. They are also used to listen to events and react accordingly.

Docs

1114 questions
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
2 answers

How to get an item in a collection with extra attributes

I currently get an item in a collection for a user like so: me.user = Backbone.Collection.Users.collection().get(id); This returns the default set of attribute required in the app. On the user profile page, I want to show additional attributes that…
AnApprentice
  • 108,152
  • 195
  • 629
  • 1,012
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

Passing a collection to multiple views

I'm trying to pass a paginated collection (backbone.paginator plugin) to multiple views so it's shared and I can call functions of my three views using the same collection. However, my main view (AttendeesView) which is calling other views…
Sky
  • 99
  • 1
  • 11
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
1 answer

How to properly switch between complex Backbone Apps in a One-Page App

I'm having several complex views/apps that all together form one big app. Think of gmail, where you have mail and contacts Or twitter, switching from profile view to settings In my case, it's a game where you can have a view to play and a map…
Xosofox
  • 840
  • 1
  • 7
  • 21
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
1 answer

Defining Backbone.Layout as require js module?

I can't definie tbranyen/backbone.layoutmanager layouts as requirejs modules. I'm pretty new to this and not a guru in javascript. Backbone.Layout is defined at this line of source code. Ayway... First try: define([ 'backbone', 'lodash', …
user1098965
0
votes
1 answer

Backbone JS How to add a new model to a view to automaticlly re-render template

I would like to attach a new model to a view and have the view re-render. I'm able to render the view in the first place, but I'm having trouble changing the data in that view to a new model. my_model_1 = Backbone.Model.extend({}); my_model_2 =…
stevenmc
  • 1,659
  • 4
  • 18
  • 27
0
votes
0 answers

How can I know the caller changed my form inputs values using jQuery backbone.js etc

I'm maintaining a long long java script code edited by many members.(unstructed code) in HTML page, there are hundreds of inputs. and the inputs' id named automatically by for loop. etc. FOR (int i;i<1000;i<++) In the javascript file . there are…
newBike
  • 14,385
  • 29
  • 109
  • 192
0
votes
2 answers

backbone selector and using find

I am seeing some strange behavior that I'm hoping someone can explain. From the render method in a backbone view I have been attempting to do the following: this.$(".msg").colorbox(); And this.$el.find(".msg").colorbox(); However in both cases,…
Conor Power
  • 686
  • 1
  • 6
  • 17
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
4 answers

Multiple backbone views referencing one collection

I am trying to create my first backbone app and am having some difficulty getting my head around how I am meant to be using views. What I am trying to do is have a search input that each time its submitted it fetches a collection from the server. I…
Justin Fay
  • 2,576
  • 1
  • 20
  • 27
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

Trouble accessing attributes in the template - all attributes apart from 'name' show error '[attributename] is not defined'

The problem is that all Object attributes apart from 'name' call the error 'id/url/whatever is not defined' in the console when accessed from the template. A template with just 'name' displays fine and shows the correct name, but as soon as I call a…