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

Backbone-relational between two models

By using Backbone-relational I would like to have the model task in this way: task = { id: 1 assigned_id: 2 name: 'read a book', user: userModel }; I did try this way (1) but the result is the following (2). Any ideas? (1) var User…
Lorraine Bernard
  • 13,000
  • 23
  • 82
  • 134
2
votes
1 answer

backbone-relational id references with backbone.marionette

I use backbone-relational's includeInJSON: 'id' to only include related model ids to avoid spamming my server-side with the whole object tree. Unfortunately, Backbone.Marionette.View by default exposes only the attributes of the view mode as…
Kris Braun
  • 1,330
  • 13
  • 21
2
votes
1 answer

View + Sub Views in backbone/backbone-relational app

I've been learning a lot about backbone, backbone-relational and building web apps from reading through stackexchange - so first a thank you to the community. Now, I am stuck at trying to understand this current issue involving nested models and…
2
votes
3 answers

How to get from one fetch request many models or collections

I have a fetch request which response looks like this. response = { id: 1, title: 'text', followers: [{}, {}] // array of objects } As you can see the response is an object which have an attribute follower which is an array of object. I…
Lorraine Bernard
  • 13,000
  • 23
  • 82
  • 134
2
votes
2 answers

Simple Self-Referential RelationalModel Fail

I am evaluating the Backbone-Relational plugin for modeling a tree. I have the following sample code var SurveyTreeNode = Backbone.RelationalModel.extend({ relations: [{ type: Backbone.HasMany, key: 'questions', …
hoffmanc
  • 614
  • 9
  • 16
1
vote
2 answers

Backbone Relational and subviews, best "save" strategy

I'm using Backbone-relational like this: class window.Car extends Backbone.RelationalModel class window.Person extends Backbone.RelationalModel relations: [{ type: Backbone.HasOne key: 'car' relatedModel: Car …
Blacksad
  • 14,906
  • 15
  • 70
  • 81
1
vote
2 answers

Backbone.js + Relational + AMD ... bootstrapping relationals

I feel sort of lost and overlooking something, but i am not sure how to approach to this and even not very much sure how to ask... First of all, i am using AMD approach (with curl.js library), which makes this probably more difficult, but i am not…
FredyC
  • 3,999
  • 4
  • 30
  • 38
1
vote
2 answers

Backbone relational lazy loading

I'm using Backbone with my RESTful JSON API in order to create an app that works with posts and their comments. I've been trying to get Backbone Relational to work, but run into problems with my Lazy loading. I load up a list of posts, without the…
JaapRood
  • 41
  • 1
  • 5
1
vote
1 answer

Combining RESTful data in Backbone Relational Models

I need to combine data from two different RESTful endpoints with backbone.js. I'm trying to use the Backbone.RelationalModel extension. So I have the following: app.Pilots = Backbone.RelationalModel.extend({ url: POST_SUBMITTER.root +…
magic
  • 37
  • 7
1
vote
1 answer

Angular relational models? Can a model refer to another model?

I have a multi-level navigation structure like so which produces the top nav: [ {id: 1, label: 'Home', icon: 'fa-home', subitems: []}, {id: 2, label: 'Sitemap', icon: 'fa-sitemap', subitems: []}, {id: 3, label: 'Contact', icon: 'fa-phone', subitems:…
Devin McQueeney
  • 1,277
  • 2
  • 14
  • 31
1
vote
1 answer

How to remove validationError from the model in store?

I made an error while updating the model, and the model now has validation errors in the validationError model property. But even I fetch the collection again and got new data for the model, the model's validationError is not gone in store. So in…
Expert wanna be
  • 10,218
  • 26
  • 105
  • 158
1
vote
1 answer

Relation between models in backbone.js

I'm looking for the correct backbone structure to achieve the following: Two server APIs: GET api/event/4 : returns the event object with id 4. GET api/event/4/registrations : returns the list of registration objects belonging to event with id 4 I…
1
vote
1 answer

Backbone Relational - Deep nested models/collections

Having some fun with Backbone-relational.js v0.10.0 I have a JSON object which contains nested models and collections, to keep this simple I have made the example below. A company can have many employees, employees can have one address and many…
Nick
  • 1,219
  • 1
  • 13
  • 24
1
vote
2 answers

Appending new data to the Backbone Relational Relation

I'm trying to design a load more type of system where every time you press load more you add data to the existing collection. This is a rough sketch of how the UI looks. Everything works pretty great except as you would except everytime I re-run the…
1
vote
1 answer

How to not remove duplicates in collection in backbone

I create backbone collection from server JSON. Data is from mongo so each item has same objects and backbone remove this duplicates. It's unwanted behavior for me so, I can't find solution to keep this instances. After fetch my items has only…
tstr
  • 1,254
  • 20
  • 35