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

Setting backbone.js model defaults to use a function

I am attempting to use moment.js to set a start_time and end_time default in my backbone model. It looks like this: backbone_init: function() { imp.calendar.CalendarEvent = Backbone.Model.extend({ urlRoot: '/#', …
-1
votes
1 answer

error is not a constructor

I am new to backbone and requirejs... I am working on a small gallery app where i came across this error in firefox firebug and in chrome it doesn't show any error chrome dev tool... please help me in this here is my…
-1
votes
2 answers

backbone filtering a collection

I am trying to filter a collection based on an attribute called status. Once filtered I want to re-render the view to reflect the filtered results. So far I have come up with this function in my collection. var ProjectCollection =…
Udders
  • 6,914
  • 24
  • 102
  • 194
-1
votes
2 answers

cant sort collection in a descending fashion

I am trying to sort my collection using .sort() however I can only seem to sort the collection in an ascending manner, by code for the collection is like this, var ProjectCollection = Backbone.Collection.extend({ url: '/projects', …
Udders
  • 6,914
  • 24
  • 102
  • 194
-1
votes
2 answers

Synching an array with a sorted Backbone.Collection

I am trying to sync a sorted Backbone.Collection with another list, e.g. a JavaScript Array. I am using the following code (jsfiddle): var coll = new Backbone.Collection(); coll.comparator = "label"; var list = [] coll.on("add", function (model,…
-1
votes
2 answers

get model by id from collection in backbonejs

I have following kind of collection [ { "id": "2324324", "name": "name", "type": "type", }, { "id": "59980", "name": "name", "type": "type", } ] model: define(['underscore', 'backbone'], function(_,…
Priya
  • 1,453
  • 4
  • 29
  • 55
-1
votes
2 answers

How to change the structure of the models in a collection from a database

So, here's what I use to get my data: $app->get('/people', 'getPeople'); function getPeople(){ $sql = "SELECT * FROM people"; try { $db = getConnection(); $stmt = $db->query($sql); …
lemeown
  • 11
-1
votes
3 answers

Backbone.js - base path not concat with subpaths

In my base collection i have the base path, from the base path i am extending further urls.. but while i console the url in the extended collection i am not getting the full path of the url.. instead just i am getting the url - what the extended…
3gwebtrain
  • 14,640
  • 25
  • 121
  • 247
-1
votes
1 answer

Backbone.js - unable to get the model inside the filter function

In my project i am returning a data using filter method, out of filter i am getting the object, but inside the filter getting as undefined... they way i doing is wrong..? any one guide me please? my complete code : var taskListGenerator =…
3gwebtrain
  • 14,640
  • 25
  • 121
  • 247
-1
votes
1 answer

backbone.js how to fill a collection with whole database table

I have defined a Model and a Collection, and since I already have records in my database, I wish to show all those records on application on page load. I tried using Backbone.sync, but I still see an empty collection in Chrome debugging mode. My…
Timothée HENRY
  • 14,294
  • 21
  • 96
  • 136
-2
votes
2 answers

var not defined - backbone.js

I am quite new to backbone.js i am trying to access a var from file B to file A. currently i have declared file A as below window.dog = Backbone.Collection.extend({ model : animal, initialize : function(){ _.bindAll(this); }, …
Divakar R
  • 773
  • 1
  • 8
  • 36
-2
votes
1 answer

How to calculate sum of a specific model (attributes) in collection in Backbone

I am new to Backbone and facing one issue in which i need to calculate the specific values of my models inside my collection. For the reference, I am pasting the collection of accounts, from which I need to calculate the sum of acquisitionCost,…
-2
votes
1 answer

Backbone collection on save error

I'm trying to get it so that when my backbone collection is saving if it hits an error I can do something with it. However when the form is saved the Render All Tasks button's click event is always triggered. How can I get it to stop iterating the…
1 2 3
34
35