Questions tagged [backbone-relational]

Get and set relations (one-to-one, one-to-many, many-to-one) for Backbone models.

Get and set relations (one-to-one, one-to-many, many-to-one) for Backbone models.

Resources:

256 questions
0
votes
1 answer

backbone-relational: usage with standalone model without relations

I am using backbone-relational. The usage for a onetomany model works fine. But I am having troubles using backbone-relational for a single/standalone model: window.BeerOnlineShopPosition =…
0
votes
1 answer

How do add to a backbone form? Where in the schema does it go?

Scout.models.Equipment = Backbone.RelationalModel.extend({ schema:{ asset_number:{ type:'Text' }, notes: 'TextArea', tag:{ type: 'Text', validators: ['required']} }, defaults: { id: null, name: null, } }); I want to add…
user757679
0
votes
2 answers

Creating selfrelated nested models with backboneJS + backbone-relational + requireJS

I know there are multiple questions about this and I have solved the first problem through those answeres. I decided to not polute my global namespace and use this type of solution. But now I have a different problem relating the same…
vonGohren
  • 929
  • 8
  • 22
0
votes
2 answers

Backbone Relational with TypeScript - findOrCreate not working when using custom idAttribute

When I define a custom idAttribute on my Backbone model, findOrCreate will not work, saying Uncaught Error: Cannot instantiate more than one Backbone.RelationalModel with the same id per type! I think this is a TypeScript issue. I don't…
user888734
  • 3,797
  • 5
  • 36
  • 67
0
votes
2 answers

How to use params from within a success callback function (Backbone)

I seem to have an issue with the parameters I am trying to set from within the success callback function: var CampModel = CampDataModel.extend({ initialize : function(){ this.fetchActiveAndPending(); …
Yuval
  • 307
  • 3
  • 14
0
votes
1 answer

Testing backbone-relational with jasmine

UPDATED: I have a simple Backbone-relational model: @App.M.Product = Backbone.RelationalModel.extend defaults: {} url: App.D.dataURL relations: [ { type: Backbone.HasMany key: 'templates' …
mreq
  • 6,414
  • 4
  • 37
  • 57
0
votes
0 answers

backbone relational: one-to-one relationship where both entities have the same id

My attempt at defining a one-to-one relationship using backbone relational. B is defined without any dependencies or knowledge of A var B = Backbone.RelationalModel.extend({ /* No relationship defined with A */ }); A is then defined, with an…
bguiz
  • 27,371
  • 47
  • 154
  • 243
0
votes
1 answer

Fire a remove event on fetching a collection

This is an odd behavior I think. I have two "section" instances. Each one with an exercises collection. Then, I do a fetch for each collection and here is the problem. From server can I to receive some model that can be in the two collections at the…
Fran b
  • 3,016
  • 6
  • 38
  • 65
0
votes
2 answers

RequireJS + BackboneRelational + Self-Referential

I've been trying to follow the example here: Creating nested models with backboneJS + backbone-relational + requireJS And ended up having something different (since I need a Backbone.Collection, not a Backbone.RelationalModel): define(['exports',…
Poly
  • 195
  • 2
  • 8
0
votes
0 answers

Delete objects in backbone-relational

let's say I have two HasMany relationships: Playlist: HasMany Clips and ClipsMegaCollection: HasMany Clips The idea is to have a sorted list of Playlists and keep a ClipsMegaCollection synchronized as the planar list of clips reflecting all the…
Lacrymology
  • 2,269
  • 2
  • 20
  • 28
0
votes
1 answer

Error callback called after succesfull Model save in the database

category = new Category({name: name, img: img}); category.save(null, { success: function(){ console.log("saved") }, error: function(){ console.log("error") } }); I have a form, and when the submit button is clicked, it captures the…
0
votes
0 answers

Backbone.js: Disallow backbone history

I came on this site to research a problem that I've been having regarding negating Backbone.js's history for certain elements. Thankfully, I came across this answer: here. While it had provided a solution for me, the ultimate result was partial.…
incarnate
  • 145
  • 3
  • 13
0
votes
1 answer

Backbone - sync doesn't detect my collection url

I have an albums and songs relationship. In the new album view I'm asking for the songs at the same time, I'm trying to save the album model first and then save the song collection and attach it to the album. My song collection…
Nocturn
  • 321
  • 6
  • 13
0
votes
1 answer

Backbone: Creating models from a Collection of Models that contain a Collection of Models

I have an API that is producing GeoJSON data of a number of Venues and Events that are occurring at each Venue. See an example output: { "crs":null, "type":"FeatureCollection", "features":[ { "geometry":{ …
alukach
  • 5,921
  • 3
  • 39
  • 40
0
votes
1 answer

Backbone.js: How to prevent multiple downloads of a related model?

Yes I know there is a plugin called Backbone-Relational but I have a serious problem with its fetchRelated function which, in my opinion, renders it useless for me. So I was wondering if there are any alternatives? Or do we even need plugins like…
craftsman
  • 15,133
  • 17
  • 70
  • 86