Models in the Backbone.js library.
Questions tagged [backbone-model]
325 questions
0
votes
2 answers
Render a View of Backbone Model returns undefined
Lets say i have a JSON like this:
JSON example, my json is validated on jsonlint and it works.
json_object = {
"texts_model": {
"hello": "hola",
"icon_text": "Icon!"
},
"collection_vias": {
"text": "hola",
"icon_text": "Icon!"
}
};
I have made a…

DiegoKTC
- 9
- 5
0
votes
1 answer
Backbone collection filter with where and get array of objects
I have a json like this:
Constants
Contents(Array)
->Sections(Array)
-->sections.attribute1
->constants.attribute1
->constants.attribute2
Templates
I have filtered the json to get a collection of Contents with this code:
var viasModel =…

DiegoKTC
- 9
- 5
0
votes
1 answer
Filter json and create backbone model and collection
I have a json file that i want to filter and create a collection of this filtered json.
How can i do this?
file.json
->Calculators
->Constants
->Contents
I want to filter the file.json and make a collection from Constants Object Items.
Is it…

DiegoKTC
- 9
- 5
0
votes
1 answer
Make a collection from a filtered model
I have a model fetch from a JSON file.
var TemplateModel = Backbone.Model.extend ({
// JSON URL
urlRoot: 'json file url',
// Fetch on initialize.
initialize:function startModel(){
this.fetch();
},
// Defaults
…

DiegoKTC
- 9
- 5
0
votes
2 answers
child collections aren't rendering in parent model view in backbone
I can't seem to get the children view templates to render. They are showing up in console log, and they are showing up the right amount of times, but I can't get them to render in the browser.
The goals are the parents and the steps are the…

Dave Merwin
- 1,382
- 2
- 22
- 44
0
votes
1 answer
Remove nested object from Backbone model
I have a backbone.js model with nested objects for fieldData as shown in image below.
I know I can remove whole attribute like this:
this.unset('fieldData');
But how do I remove an individual objects (eg:- dataPartnerCodes) in that…

RuntimeException
- 1,135
- 2
- 11
- 25
0
votes
1 answer
Loading collections into models in backbone.js
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 tried…

Dave Merwin
- 1,382
- 2
- 22
- 44
0
votes
2 answers
backbone why using model in collection
why use model inside collection, can someone explain me?
Example:
var model = Backbone.Model.extend({
url: '/rest/article/'
});
var collection = Backbone.Collection.extend({
url: '/rest/article',
model: model
});

Mirza Delic
- 4,119
- 12
- 55
- 86
0
votes
1 answer
Need ONE end to end example of using Backbone.js and restful webservice in java
I have just started working with backbone.js and facing some problem in retrieving the data from the Restful webservices in java and giving it to the model.
I searched on internet but could not find a good reference showing one end to end flow.
If…

Hemal
- 265
- 1
- 7
- 17
0
votes
2 answers
Bind a method after Backbone's fetch event
var BasicModel = Backbone.Model.extends({
url : function() {
return "/something";
}
});
var basicModel = new BasicModel();
basicModel.fetch();
If BasicModel is a collection, then the follwoing is possible
this.on("add", function…

Nageswaran
- 7,481
- 14
- 55
- 74
0
votes
1 answer
Backbone collection's models-object incorrect structure?
I believe that, somewhere along the way, my Backbone collections aren't storing their models correctly. I'm also using backbone-pageable to have paginated collections, and my backbone app is based on https://github.com/alessioalex/ClientManager and…

RTolton
- 53
- 1
- 4
0
votes
1 answer
How to make ajax call to get the data from url using backbone js
I am new to backbone js and i wanted to call one external url and i want the which will fetch from the url output.
I have tried like the following
var MyApp.myModel = Backbone.Model.extend({
url:…

siva
- 1
- 3
0
votes
1 answer
How do you handle async linked models in Backbone views
When rendering a Backbone.View you generally pass it the current state of the model model.toJSON() and maybe a few extra properties. This is a synchronous task.
How do you deal with attributes on the model which require async tasks like an id of…

Dave Taylor
- 1,931
- 2
- 17
- 30
0
votes
1 answer
model.on('change', function()) not working properly
I am using backboneJS model.on ('change:attribute',functionName(someParameter)) to listen to change in model's attribute and call a funcion with given parameter. But the problem I am facing is the function is being called initially even when there…

NehaN
- 164
- 1
- 5
0
votes
1 answer
Backbone Model change data in one instance affects another
I just had a weird bug when using Backbone.Model
so I have the model declaration something like:
var MyMode = Backbone.Model.extend({
defaults:{
'someList': []
},
initialize: function(){
_.bindAll(this, 'toString',…

Matthew Yang
- 605
- 1
- 13
- 23