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
0
votes
1 answer

Backbone.js Collection's fetch call is erroring out

Still wrapping my head around Backbone, and running into an issue where my Collection won't populate when I'm passing it JSON from a file. The fetch() call is erroring out, but I'm not sure how to debug it exactly, as my console.log()'s aren't…
0
votes
1 answer

populate collection on Backbone

Tutorial.Views.Layout = Backbone.Layout.extend({ model: Tutorial.Model, }); initialize: function () { _.bindAll(this); this.model = new Tutorial.Model({id : $("#data").data('user') }); this.collection = new Tutorial.Collection(); var…
0
votes
1 answer

Backbone Collection Fetch and the form of the Request

I have a backbone collection var Stuff = Backbone.Collection.extend({ url: "stuff/" model: StuffModel }); I also have an array of ids: var ids = [ 1, 2, 3, 4 ]; As per the docs, I call fetch on Stuff like so: this.collection.fetch( {…
user1031947
  • 6,294
  • 16
  • 55
  • 88
0
votes
1 answer

...fetch() and toJSON() response is not matching

I am making a service call using collection url. The service returns some json, the json length is 13 (in short 13 rows of data). Here, this.Collection.fetch() is returning json who's length is 13. but this.Collection.toJSON() is returning json…
Ashwin Hegde
  • 857
  • 2
  • 8
  • 11
0
votes
2 answers

Populating backbone collection with empty models as placeholders

I'm writing a web application using backbone. I am going to display a list of thumbnails in grid format on a webpage. I have created a view called PhotosView, which is listening to backbone collection PhotosView = Backbone.View.extend({ …
0
votes
1 answer

pulling in a collection with backbone.js

I am trying to pull in a collection from the url attribute and am having some problems. It seems fetch() returns successfully, but then I cannot access the models in my collection with get(). I am using bbb and requireJS to develop my modules var…
Jeff
  • 2,293
  • 4
  • 26
  • 43
0
votes
1 answer

How do I reference a model from within a backbone.js view?

I am new to backbone.js and attempting to use patterns that I have used in other languages. Some of them work and some have fallen quite flat. My questions is this - how should I reference my model from within a view. For example, I have 5…
0
votes
1 answer

Backbone create sending no data to server in Http Post?

I have a very simple model called "gameModel" and a collection "gamesCollection" shown below. When I try to create a new game in the collection it sends a post to the server but that post has no data in it. Does any know what is going on? //The…
Usman Ismail
  • 17,999
  • 14
  • 83
  • 165
0
votes
1 answer

Backbone.js collection fetch, can't retrieve items

I'm new to Backbone.js, I'm following a tutorial trying to adapt it to my needs. I'm calling the fetch method from the main app view in order to retrieve multiple objects to be inserted in the collection. I can see in chrome that the json data are…
Leonardo
  • 4,046
  • 5
  • 44
  • 85
0
votes
1 answer

why collection.reset works like collection.add?

I have a view with a Backbone collection. When I reset the collection through backbone.signalR hub, I expect to get a new collection which I pass through my hub but it just resets the collection and then works like calling collection.add on whatever…
0
votes
2 answers

what is the best way to save a collection in backbone?

I have no problem saving a model one at a time, I wrote a recursive save on an array of objects. on each successful save, i shift out an object and if the array length is not 0 -> repeat... once the array length reaches zero then I know all saves…
jsdev
  • 1
  • 1
0
votes
1 answer

How to avoid using Backbone-relational, a simple blog backbone app with comments relating to posts

Backbone relational is too messy for me and I can't seem to debug it. I am trying to avoid using this asset. I have two collections in my Backbone app. Voice.Collections.Posts and Voice.Collections.Comments This is my router: class…
0
votes
1 answer

Backbone.js model property is getting not defined error

I'm very new to Backbone.js and am trying to get this simple example working. Basically, in jsFiddle when I run the code it tells me that the property "firstname" is not defined. Here's a link to the…
cpeele00
  • 883
  • 4
  • 14
  • 29
0
votes
1 answer

Backbone collection is not updating when api is polled

I'm having some trouble getting change events to fire when a model is updated via polling of an endpoint. I'm pretty sure this is because the collection is not actually updated. I'm using the new option (update: true) in Backbone 0.9.9 that tries to…
0
votes
1 answer

requestNextPage() not a function in Backbone.Paginate

I am writing a backbone collection which requires pagination. So this is my code define([ 'underscore', 'backbone', 'models/object', 'backbone_paginate' ], function(_, Backbone, Object){ "use strict"; var myCollection=…