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
12
votes
4 answers

Creating nested models in Backbone with Backbone-relational

I would like to use backbone-relational to have nested models in my backbone.js application. I have been able to follow the examples in the documentation to create nested objects (e.g. one-to-many relations). However I don't understand how to…
Christopher DuBois
  • 42,350
  • 23
  • 71
  • 93
11
votes
3 answers

Where can i find some Good backbone-relational tutorials?

I'm learning backbone.js and the whole microcosmus around it now! But i'm still stunning on one Plugin : The Backbone-Relational. On github the Documentation is really too short, not for beginner! that's how i feel it! Do someone have a Tutorial…
3logy
  • 2,634
  • 8
  • 46
  • 99
11
votes
1 answer

Backbone-relational hasmany best practices

I am new to Backbone-relational, I am not sure what is the right way to use HasMany. I have a Parent model which have many children (by "many" I mean thousands of children). In order to avoid performance issue, I query children by their foreign key:…
11
votes
3 answers

Testing a backbone relation model by using jasmine

Let's suppose I have two simple fixture files, one for the user(1) and one for the messages(2). The Backbone Model for the messages is the following (3). If I load the "Message Fixture", I would like to have also the related info…
Lorraine Bernard
  • 13,000
  • 23
  • 82
  • 134
11
votes
2 answers

How to handle relations in backbone.js

I'm stuck with how to design my backbone.js application regarding to my model relationships. If I have an event model , that has a couple of relationships, say a user model can have many events and the event model in turn can have many comments and…
jonepatr
  • 7,769
  • 7
  • 30
  • 53
10
votes
4 answers

Creating nested models with backboneJS + backbone-relational + requireJS

I am new to BackboneJS and I am stuck with nested relations using Backbone-relational Model with RequireJS -I think I runned into circular issues. Any help will be highly appreciated! I have the following model and collection: /* Module Model at…
user1305990
  • 101
  • 1
  • 4
10
votes
3 answers

How to build a Collection/Model from nested JSON with Backbone.js

I'm relativly new to Backbone.js I have a JSON like the picture shows ! I saw some Answers in relation with Backbone-relational, but still dont get the point! How can i convert this JSON to Backbone.js Collections/Models?? I update with a code but…
3logy
  • 2,634
  • 8
  • 46
  • 99
9
votes
2 answers

Foreign key populated with an object

I would like to make a relation between two models User and Task using backbone-relational. The relation between the two models is the following: taskModel.creator_id = userModel.id // TaskModel var TaskModel =…
antonjs
  • 14,060
  • 14
  • 65
  • 91
8
votes
3 answers

RelationalModel relation field at NULL after job's done

I got a wtf problem that I can't figure out. I explain : I have a model named Product : var Product = Backbone.RelationalModel.extend( { urlRoot: Backbone.rootApiUrl + '/products', defaults: { id: '', name: '', …
8
votes
1 answer

Understanding layouts in Marionette for Backbone.js

I think I may have a fundamental misunderstanding of how Marionette.Layout is intended to be used. I'm trying to something like this: The layout includes two Marinotette.ItemViews: The "Explode" ItemView and the "PopStar" ItemView. This layout is…
7
votes
2 answers

Implementing a Many-to-Many relationship with Backbone-Relational

I have a simple application which defines two classes, a Person and a PersonGroup, wherein there is a many-to-many relationship in place. A Person can have no group, or be assigned to all groups, and anything in between. The example on…
Trevor Elliott
  • 11,292
  • 11
  • 63
  • 102
7
votes
2 answers

How to make Backbone-Relational (0.8.5) work with RequireJS?

After another long research, sth comes out :-) It seems the problem is about the function "getObjectByName". It can not work well with requireJS(ADM). Currently, I have to setup a globel var to fix the problem. I am sure there must be have better…
bighammer
  • 73
  • 1
  • 4
7
votes
3 answers

Backbone relational - cannot instantiate more than one ,,,

I have been using backbone relational (https://github.com/PaulUithol/Backbone-relational) to build my application because I have a model (Room) with lots of other models attached: Room has many Comment Room belongs to Location As you can see in…
GTF
  • 8,031
  • 5
  • 36
  • 59
7
votes
1 answer

Backbone-relational cannot instantiate two RelationalModel objects

I am trying to implement BackboneRelational and keep getting "Cannot instantiate more than one Backbone.RelationalModel with the same id per type!" class App.Models.User extends Backbone.RelationalModel urlRoot : '/api/users' idAttribute:…
Stpn
  • 6,202
  • 7
  • 47
  • 94
7
votes
1 answer

Using Composite Views with Backbone Marionette and Relational

I've been using Marionette for a couple of weeks and just discovered Backbone Relational so I'm trying to figure out how to integrate the two. Ideally, I would like to use a composite view to render data that is structured like this where each…
Will Hitchcock
  • 4,648
  • 3
  • 22
  • 32
1
2 3
17 18