Models in the Backbone.js library.
Questions tagged [backbone-model]
325 questions
1
vote
2 answers
Send ajax request on click event in backbone js
Here's the code
This is model
var TodoItem = Backbone.Model.extend({
url: 'list.php',
DeleteTabItem: function (child, parent) {
jQuery.ajax({
url: 'delete.php',
});
}
});
This is view
var TodoView =…

Vijaykumar K
- 17
- 1
- 10
1
vote
1 answer
date is malformed when sending as json
I am trying to send json to server and i get the following exception:
Resolving exception from handler [public void
com.hexgen.api.facade.HexgenWebAPI.createInvestAdjust(com.hexgen.ro.request.InvestAdjustRO,boolean)]:
…

Java Questions
- 7,813
- 41
- 118
- 176
1
vote
2 answers
destroy always returns with the error callback (although everything seems to be ok)
I'm trying to delete a model on my backend and what I do is this (the code is adapted just to show you the issue, some parts could be missing):
attending= new Backbone.Model();
attending.url= this.url() + "/reject";
attending.set({
id:…

Bertuz
- 2,390
- 3
- 25
- 50
1
vote
1 answer
Backbone fetch and reset model when model added to collection
I have a fiddle here
That contains a model
Item = Backbone.Model.extend({....})
Apvdtl = Backbone.Model.extend()
and a collection
Apvdtls = Backbone.Collection.extend({
model: Apvdtl
})
and populate the collection with Apvdtl…

jrsalunga
- 409
- 2
- 8
- 20
1
vote
1 answer
Model creates new row instead of being edited
I am working on app at moment, when I create a group the save function works great the model gets added to the collection, and saved to the database, however if I then want to edit the group I have just made, when I hit save the new model is created…

Udders
- 67
- 2
- 9
1
vote
2 answers
Overriding the Jquery ajax success
Hi I have a base Model -
var BaseModel = Backbone.Model.extend({
initialize : function(input){
// Some base initialization implementation common for all Concrete Models
},
ajaxCall :…

Student
- 4,481
- 8
- 27
- 32
1
vote
1 answer
Backbonejs collection.fetch() enforce default model parameters
After upgrading Backbonejs to 1.0, fetching collection from server enforces default properties that are not in response.
To be more specific I have created this test that can be verified in jsfiddle.
Suppose we have a backbone model definition with…

recallfx
- 146
- 7
1
vote
1 answer
Data passing via model in backbone
I have the following code which works well using jquery-ajax call written. However i cannot figure out how to pass values via model. From some research i have done something and you can see it below(just above the ajax call).
I want to replace the…

Roy M J
- 6,926
- 7
- 51
- 78
1
vote
2 answers
backbonejs - fetching multiple model
i'm novice in backbonejs and i'm doing some project that includes fetching and displaying friends list. for this project i'm using parse.com as database. but i'm stocked at this point.
for example: i have following data's in user and friends…

krozero
- 5,929
- 3
- 21
- 33
1
vote
1 answer
passing the url property to model not working
I have a simple inheritance hierarchy of Backbone views, and want all of my views to have one generic model. Only the url property of the model in these views will differ. so I pass the url when initializing the model.
The parent generic view is:…

Khalid Dabjan
- 2,697
- 2
- 24
- 35
1
vote
2 answers
Why do BackboneJs Collections have URL's?
I'm starting to use backbone.js and I'm confused as to why you can specify url's in a bunch of different ways. It doesn't seem like the collection url is used anywhere except in the model url function. So is there any harm in just setting urlroot on…

bdwain
- 1,665
- 16
- 35
1
vote
1 answer
Dynamic Attributes on Backbone model
I have a backbonejs model called User. User has properties city, state, and country. I have a function on this model called locationString that outputs a comma separated list based on if properties on the model are presnet or not. i.e. Atlanta,…

kwbock
- 647
- 5
- 13
1
vote
1 answer
Backbone.js dynamic type model similar to T type in java
I am updating to my earlier question based on the comment to get better understanding:
//Model's
Student = Backbone.Model.extend({
defaults: {
name: ''
}
});
Students = …

astra03
- 505
- 1
- 7
- 18
1
vote
1 answer
BackboneJS: How to assign multiple models in a single view
How do you call multiple models in a single view
Usual case is that you create a backbone model
var myModel = Backbone.Model.extend({ url:"api/authentication"});
and then assign it to a view, making it the default model of a certain view
var…

Barry
- 1,587
- 2
- 13
- 19
1
vote
1 answer
backbone.js a url property must be defined
I'm trying to use Backbone.localStorage as a backend to an app.
I wrote a Model called Era, and a corresponding EraView. Pressing enter in the EraView causes the model to be saved, and this is where I get the error:
Uncaught Error: A "url" property…

lowerkey
- 8,105
- 17
- 68
- 102