javascript - backbone collection undefined on sync -
For some reason my store is set to be undefined when I get it if I log the archive before fetching I actually get this:
If I log in after fetching (when the sync event is triggered) I get undefined.
View
App.Views.Overview = Backbone.View.extend ({template: tpl.overview, tagname: "div", id: "overview", initialize : Function () {Console.log ('Starting observation'); this.collection.on ("sync reset", this.render);}, render: function () {console.log (this.collection) ; $ (This.el) .html (this.template); it returns;}});
Archive
app. Colections. Gardens = backbone compilation. Extension ({Model: App.Models.Garden, url: Settings.API + "/ Plant"});
model
App.Models.Garden = Backbone.Model.extend ({default: {id: "undefined", owner_id: "undefined", Name: "undefined", width: "undefined", height: "undefined"}});
creation
In this way I make this scene:
var gardens = new app.collections.Gardens ( ); Gardens.fetch (); This.overview = New app View. Overview ({archive: garden});
Thanks advance!
Comments
Post a Comment