Questions tagged [backbone-model]

Models in the Backbone.js library.

Docs

325 questions
0
votes
1 answer

Backbone collection full of data, but models are empty

With Backbone.js, I'm trying to bootstrap my data into a collection. My bootstrap looks like log.reset( ); When I console.log my collection I see a bunch of objects full of data. The problem is when I console.log on the individual models in…
0
votes
1 answer

Backbone update model

In backbone I have created the following models,collections, and views var sensor= Backbone.Model.extend({}) var sensorCollection = Backbone.Collection.extend({ model: sensor }) var sensors= new sensorCollection; var SensorView…
jacobronniegeorge
  • 557
  • 1
  • 10
  • 21
0
votes
0 answers

Backbone doesn't forget previous model

I'm trying to create a page where I can see list of my items, and edit them when clicked (on a separate page). But when I browse trough different items (models), and then try to edit one item, every other item that I have loaded edits too. My…
0
votes
1 answer

PHP Variables to Backbone.js model

I have a backbone.js model I also have a php form with a particular string stored in a $_GET[value] . I need to pass that string to a backbone model and update the values in the backbone variable with the value from the php variable.
jacobronniegeorge
  • 557
  • 1
  • 10
  • 21
0
votes
1 answer

this.model.destroy doesn't do anything

I am trying to remove a view once the user clicks on something and then also delete the model thats associated with that view. I am successfully remove the model however this.model.destroy method doesnt send any server requests ? this is how my…
s_curry_s
  • 3,332
  • 9
  • 32
  • 47
0
votes
1 answer

How to pass JSON from model to view and display the JSON as table in backbone js?

i have a method "getSegmentGroup" in my MODEL to create a json with limited fields from data feteched through fetch(which has all records and fields). My model method looks like the following getSegmentGroups: function(customerIds, column1Name,…
Raju.allen
  • 341
  • 2
  • 9
  • 21
0
votes
1 answer

saving the response value to the backbone model which made the Save() call

here is my login model LoginModel = Backbone.Model.extend({ initialize: function(){ }, defaults:{ userName: 'undefined', passwd: 'undefined' }, urlRoot:…
yokks
  • 5,683
  • 9
  • 41
  • 48
0
votes
1 answer

Backbone.js Model not calling success when fetched

Having an issue with a Backbone model not calling the success function when data is returned. Fetch request # Fetch data @users.fetch({ success: -> alert("test") reset: true })
Dallas Clark
  • 4,064
  • 3
  • 30
  • 36
0
votes
2 answers

backbone.js model option collection not setting url

In the back bone docs it specifies that one can link a Model to a collection by passing in the collection as an option when initializing a Model. The model should then be able to build it's own url from the collection. var MyCollection =…
code shogan
  • 839
  • 2
  • 9
  • 25
0
votes
1 answer

BackboneJS: Modify a single model from different views

How can I modify a single model from different views? Pseudo code: var myModel = Backbone.Model.extend({url: 'rest'}); var myCollection = Backbone.Model.extend({}); var myView1 = Backbone.Views.extend({ initialize: function() { // sets a…
Barry
  • 1,587
  • 2
  • 13
  • 19
0
votes
2 answers

destroy() does not send DELETE request

I know this has been asked many times but I cannot find the solution to my issue. In all the other questions the answers had to do with the ID not being set or being something else like _id etc. I dont have any custom sync or destroy methods.…
Harry
  • 13,091
  • 29
  • 107
  • 167
0
votes
1 answer

Unable to remove the "view" of a model

In my view, i have a click event called clear to remove both model, and element from the page.. to use this in my view i have the function like this: define(["backbone","../router/router"], function(Backbone,router){ "use strict" var…
3gwebtrain
  • 14,640
  • 25
  • 121
  • 247
0
votes
0 answers

Backbone model.save() sending request to root url

So when I call save on a new backbone model, save is sending a request to the base url defined in the model. what I want is for save to issue a request to url/create. the model isNew() returns true and all.
0
votes
2 answers

Backbone.js: Grabbing the length of a collection for use with random number

I want to grab the length of a collection to use in a random number generator. I want a view that shows one model of the collection, randomly generated. I'm using coffeescript, btw So far I've tried stuff like @collection.fetch data: id:…
0
votes
1 answer

Backbone Create model with Django Rest Framework

Im trying to create a new model with a rest api using Django Rest Framework. This is my serializer: class FooSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Foo This is my view.py @api_view(['POST',…
Harry
  • 13,091
  • 29
  • 107
  • 167