Questions tagged [backbone.js-collections]

For Backbone questions specific to Backbone's collections.

Backbone collections are order sets of models. Collections forward events on their models to the collection's listeners for convenience.

523 questions
5
votes
1 answer

how to Pass value From Collection to model in backbone.js

I want to pass and fetch a value from the view to model use of a collection, i am able to pass the value into the model when i used collection it is not working .i don't know where is the problem here is my code . my model var…
Sport
  • 8,570
  • 6
  • 46
  • 65
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
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:…
5
votes
1 answer

parse nested json to backbone collections

I'm just starting with Backbone and I'm running into a problem. I have a nice restful setup. For most of my GET request I receive a single collection of models, but for one I am loading nested relational data, which creates nested JSON. In Backbone…
lunacafu
  • 357
  • 8
  • 20
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
4
votes
1 answer

Nested Models and Collection in backbonejs

I am looking for a solution to load the nested json in the parent model to be eventually rendered on screen. I have a nested json in this format: { "name":"Hotel-A", "description":"5 star rating", "geographicAddress":{ …
4
votes
1 answer

backbone.js adding model to collection adds to all models in collection

Playing around with backbone.js, so far I've created models and collections for a deck of cards and two players. The problem is when I try move a card from the deck and add it to the player's hand the card gets added to all players hands. Here's my…
4
votes
1 answer

How do I implement the Backbone model in latest Parse js sdk (1.6.2)?

The Parse Collection class corresponding to Backbone.Collection is no more in the SDK. It used to be there in 1.2.13.
4
votes
1 answer

listen to a collection add/change as a model attribute of a view

I have a Measure View, and it has an associated Measure Model, which has two collections, RepresentationsCollection and BeatsCollection. The Measure View has nested child Representation views, each with their own representation model, and all…
4
votes
1 answer

Backbone collection within model + restful server design using Node.js

I'm trying to develop a simple file browser using Backbone for the client and Node.js for the server. At the moment I'm quite stuck on how to design the model when it comes to subfolder Client code looks something like app.MyFile =…
GantengX
  • 1,471
  • 2
  • 16
  • 28
4
votes
1 answer

defining a new backbone collection

I was trying to extend backbone collections, the first way i was doing new in the declaration and in the second I declared first and then I created a new instance. Is doing the first wrong, what is the difference? var AppointmentList = new…
whatf
  • 6,378
  • 14
  • 49
  • 78
4
votes
1 answer

Backbone JS - this.model.models instead of this.collection?

I'm new to Backbone JS and have been following Christopher Coenraets Wine Cellar tutorial. It all works fine and dandy but I don't understand how he is using this.model.models to access a collection rather than this.collection. Furthermore when I…
HankHendrix
  • 295
  • 2
  • 9
4
votes
2 answers

Backbone - Declare Default Parameters for a Fetch inside a Model

I have some global parameters that I want to be sent in every time I call a fetch on a collection... my issue is I don't want to declare the data: { ... } every time I fetch. Is there a way I can provide default parameters inside the Collection…
Adam Storr
  • 1,438
  • 2
  • 21
  • 46
4
votes
2 answers

Fetch data from different urls using the same collection in backbone js

I have a collection which has to call 4 external apis Eg: http://www.abc.com, http://www.fgt.com, http://www.jkl.com and http://www.rty.com. I have a Collection named Todos.js. Is there a way I can fetch the 4 apis together in a single collection…
4
votes
1 answer

BackboneJS collection add event fired on multiple collections

I am running into an issue where I'm adding to a collection, CollectionA, where CollectionA and CollectionB are listening for an add event. However, an add event is triggered for both collections when adding to CollectionA. CollectionA and…
1 2
3
34 35