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
2
votes
3 answers

How I can clear the cache of Backbone relational?

How I can clear the cache of relational Backbone? relational backbone remembers the previous values ​​after fetch
mstafkmx
  • 419
  • 5
  • 17
2
votes
2 answers

Backbone js + Require js + backbone relational + circular dependency + self references

I've recently been experiencing issues with Backbone and Require JS as we have a fairly complex data model that I need to represent that is causing issues with circular dependencies and self references. I've read a bunch of posts online (none of…
2
votes
1 answer

The "right" way to create a new backbone-relational model instance in a hasMany relation

I'm a Rails guy trying to become a Rails API server + Backbone front end guy, and I have a strong feeling I'm not doing something right with respect to creating new instances of a model inside a collection contained in another object. In all the…
JP Slavinsky
  • 345
  • 3
  • 9
2
votes
2 answers

Why / When I should use the Backbone-relational framework

I got a confusion sate now, any one clear my doubt and give more details about http://backbonerelational.org/ please? basically, Why we use the relational When we need to take a decision to use that Can't we achieve the same with Backone.js…
3gwebtrain
  • 14,640
  • 25
  • 121
  • 247
2
votes
1 answer

Backbone relational, keep foreign key ids when using relations in models

i have working example of code with relations, but there is a lack - backbone replaces my foreign id with related model, i would like to keep as foreign id and to add related model with new key.. is it possible? In the following example engineId…
avasin
  • 9,186
  • 18
  • 80
  • 127
2
votes
3 answers

temporary backbone collection for editing models

Im working with a collection and models: var StuffCollection = Backbone.Collection; var StuffModel = Backbone.RelationalModel; in one place I make an instance of that collection with models: var stuffCollection = new StuffCollection(); // do stuff…
Kev
  • 705
  • 1
  • 5
  • 10
2
votes
1 answer

relatedModel does not inherit from Backbone.RelationalModel -- using RequireJS and exports for circular dependency

I've run into a problem that may have to do with my lack of understanding of the use of exports / RequireJS for circular dependencies. I'm getting the error relatedModel does not inherit from Backbone.RelationalModel. On to the code (in…
2
votes
1 answer

Events in Backbone Relational: What are they for, what they do, and can the triggers be safely removed?

I have been trying to decipher backbone.relational source code. I found that it fires a lot of its own events. I did a log on some of my models, and found that a lot of these events seem to fire off for no reason. Big question is which events should…
Toli
  • 5,547
  • 8
  • 36
  • 56
2
votes
1 answer

View-specific modifications to Backbone collections

I have a Backbone model (let's call it Foo) that includes a collection of n sub-models (let's call them Bar), and in one particular view, I only want to display m of those sub-models, along with a message along the lines of "(n-m) remaining". Right…
David Moles
  • 48,006
  • 27
  • 136
  • 235
2
votes
0 answers

In Backbone Relational how do I silence add:* events on fetch()

When I load in my model using .fetch() backbone Backbone Relational fires off an add:survey_question for each question it adds (which is the same thing that would happen if load something onto my survey_questions collection via .add(). Even worse,…
Toli
  • 5,547
  • 8
  • 36
  • 56
2
votes
2 answers

How do I use & access a Backbone.js Collection as property/attribute in a Model?

I'm new to Backbone (still stuck in Ruby on Rails mode) and am a bit confused about how to add a Collection to a Model as a property/attribute (is "attribute" the correct term?). For example, I have a Model named current_plan, and a variable named…
2
votes
0 answers

Backbone-Relational firing add event before server responds

I'm using Backbone-Relational in a project at the moment, and it's not behaving the way it seems like it should. Let's say Model A has a HasMany relationship with Model B. Model A listens for an "add:model_b" event to render a necessary view for…
Richard Stokes
  • 3,532
  • 7
  • 41
  • 57
2
votes
0 answers

Trouble getting backbone relational to work in a graph (node/tree) model

I'm building a hierarchical data model out of some flat data using backbone and running into a problem when i'm trying to use a relational model. The output of the below code looks like this: "D" "B" "C" "F" "G" …
Devin McQueeney
  • 1,277
  • 2
  • 14
  • 31
2
votes
1 answer

Backbone relational save fires add: even when models are already present

I am using BackBone relational as very useful extension of Backbone.js. I have an issue however after saving a backbone relational model with a 1 - M relationship. The problem I am seeing is that, after model.save(), the add: is fired once again for…
Conor Power
  • 686
  • 1
  • 6
  • 17
2
votes
2 answers

Backbone.js architecture for a sign in and sign out functionality

I'm a little unsure about how to set up functionality for a login/logout control in Backbone.js. This is what I'm thinking, but I'm not sure if this is ok or if there are problems with this architecture: The Model is the current user. If the model…