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

Backbone.js - How to handle multiple models with the same id and type? Or how to avoid that situation

I've been running into a few situations recently, where I have multiple views on the page that need to be backed by a single model. This way, just by modifying the model, all of the relevant views will automatically update their appearance. The…
JayD3e
  • 2,147
  • 3
  • 21
  • 30
3
votes
0 answers

Creating children objects of not saved model in Backbone using Backbone-relational

I'm new to backbone. I have rails3 app. These are my backbone models: class AppName.Models.Order extends Backbone.RelationalModel paramRoot: 'order' relations: [ type: Backbone.HasMany key: 'order_services' relatedModel:…
3
votes
2 answers

Backbone-relational with Require.js (AMD)

I'm working on a fairly large web app in which I am going to be using require.js so I can compile it once it's ready for production, but I would like to use backbone-relational. I am also going to be using backbone-marionette, but I am not sure how…
Tom Brunoli
  • 3,436
  • 9
  • 36
  • 54
3
votes
2 answers

Backbone.js - access all child views inside a parent "collection" view

Need to call .delegateEvents() on all child views inside a parent "collection" view in order to re-delegate events after having removed the parent view from the page and then put it back on. I can see two ways of doing this, both of which don't…
3
votes
1 answer

Backbone-relational functions on collections

I am doing a somewhat large backbone based web app, and I am using backbone-relational. I was wondering if I could have a custom function on the one-to-many relations. I.E. If I have a country model and it is related to multiple metadata models…
Tom Brunoli
  • 3,436
  • 9
  • 36
  • 54
3
votes
1 answer

backbone.relational - key, keySource, keyDestination

I have the following two models: User and Job. Each user can have just one job. The user.attributes and job.attributes look like these (1): (1) user.attributes = { id: 1, name: 'barName', job_id: 5 } job.attributes = { id: 5, …
Lorraine Bernard
  • 13,000
  • 23
  • 82
  • 134
3
votes
1 answer

Backbone-Relational related models not being created

I'm trying to create a nested, relational backbone project but I'm really struggling. The rough idea of what I'm trying to do is shown below but I was under the impression upon calling fetch() on Client, a number of bookings would automatically be…
Chris Gilbert
  • 348
  • 5
  • 12
3
votes
1 answer

relation model between two models: null value

I would like to make a relation between two models User and Task using backbone-relational. I would like for each Task to get the User model. The relation between the two model is the following: taskModel.creator_id = userModel.id Here is my…
Lorraine Bernard
  • 13,000
  • 23
  • 82
  • 134
3
votes
1 answer

Using functions to manage relationships in Backbone

I am working (for the first time) with Backbone.js in creating a reasonably simple application. I am currently working with two entities that have a one-to-many relationship: Project: has many groups Group: belongs to one project I looked at a few…
jackwanders
  • 15,612
  • 3
  • 40
  • 40
3
votes
2 answers

Backbone-relational fetchRelated not sending request

I'm using backbone.js and backbone relational 0.5.0 with a Rails 3.2 backend. I have a Card model which has_many Notes. Here are my JS models and collections: Workflow.Collections.Cards = Backbone.Collection.extend({ model:…
Stu
  • 154
  • 1
  • 11
2
votes
1 answer

Using Backbone Relational to handle JSON-API Data

We've been using Backbone Relational to model our ORM relationship in the front end for instance: { id: 2 username: "bob" comments: [ { id:5, comment: "hi", user: { username: 'Bob' } } …
user391986
  • 29,536
  • 39
  • 126
  • 205
2
votes
2 answers

Backbone Relational collection with duplicate ids

I'm using backbone relational for my collection handling. I have a complex object which may have duplicated ids inside. e.g. { id: "things/1", children: [ { id: "things/2", children: [ { id:…
Craig Brett
  • 2,295
  • 1
  • 22
  • 27
2
votes
1 answer

Backbone model save() with Django Tastypie

I'm working on some code that relies on Backbone, Backbone-relational and Tastypie working together. (If it matters, I've included the backbone-tastypie library). I have a Basket model that stores some properties about itself, and can HaveMany Fruit…
Leah Sapan
  • 3,621
  • 7
  • 33
  • 57
2
votes
1 answer

Disabling user input within a Marionette collection view - that is being updated by other parts of the application

Need to disable input buttons for items within a Marionette collection view. Normally I'd just do: TheView.$el.find('input').prop('disabled', true); That should disabled all input elements within the view. The problem I am having is that other…
Chris Dutrow
  • 48,402
  • 65
  • 188
  • 258
2
votes
0 answers

Backbone relational into ItemViews?

UPDATE I am still not 100% but I made a fiddle that seems to be working well NEWWORKINGFIDDLE I am still testing it to see if there are any caveats, but this seems to work great, looks like I can drop backbone relational and Deep model :) All I…
Michael Joseph Aubry
  • 12,282
  • 16
  • 70
  • 135