My models already have a defaults hash. When parts of the view/page are reset, I wish to reset the models back to their original defaults.  Currently, I explicitly set each attribute to its default value. Is there anything built in or a JavaScript/Un...
I bind on the change event of my backbone models like this.  this.model.on( "change", this.render, this );   Sometimes I want to fetch the latest version of the model and forcibly render the view.  So I do this  this.model.fetch();   Unfortun...
Here's the goal: I have a parent model. It is in a collection called parents. In a parent is a collection of children. So, when I instantiate the parents collection, I get the parent models, each with the collection of children in them.  I've...
I have a simple question about Backbone.js' get and set functions.  1) With the code below, how can I 'get' or 'set' obj1.myAttribute1 directly?  Another question:  2) In the Model, aside from the defaults object, where can/should...
When developing Backbone applications, I often find myself instantiating models in views when dealing with nested data. Here's some example data:  {   name: Alfred,   age 27,   skills: [     {       name: 'Web development',       level: &...
The reason I'm late to the backbone party is because I'm worried it wont play nicely with my existing webservice.  I have even got to the point where I'm using my own version of backbones controllers and models, but its fruitless to just...
I have a backbone model returning something like this:  {     language: "us",     us: {         title: "Gigs",         subtitle: "Stay tune to my upcoming gigs"     },     br: {         title: "Shows",         subtitle...
In my view's method below, my model gets synced with the server if I understand the create() method properly. However, the console.log of this.model.id still returns undefined and this.model.isNew() returns true. The POST shows an id in the retur...
My API response:  {   firstName: '',   lastName: '',   notifications: [     {       category: '1',       subcategory: '',       source: '',       optInDate: '',       optOutDate: '',       activ...
I have the following Backbone Model and Collection  /**  *  DataPoint  */ var DataPoint = Backbone.Model.extend({     defaults: {         ts: null,         value: null     } });  var DataPointCollection = Backbone.Collection.extend({     model: DataP...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.