I'm either really tired or really confused ... But I'm not sure ... I have the parse.com javascript setting (this is exactly the same as backbone.js, using syntax instead of base). And I have a model, and a collection, and it all works. But darn to Jones (); doesn't work, it just returns [] in console.log ... However, if I run the same function in the Chromes console, it works and returns the correct values.
Any help !?
All this beautiful code is wrapped up in the document ready (and it had a different code that is not relavent and yes, I have Parse.initialize()'d it.
var Schedule = Parse.Object.extend({
className: "schedule"
});
var ScheduleList = Parse.Collection.extend({
model: Schedule
});
schedule = new ScheduleList();
schedulejs3 = schedule.toJSON();
schedule.query = new Parse.Query(Schedule);
schedule.query.ascending("date");
schedule.query.limit('500');
schedulejs2 = schedule.toJSON();
schedule.fetch();
schedulejs = schedule.toJSON();
console.log(schedulejs,schedulejs2,schedulejs3); <-- All three return []
var ScheduleView = Parse.View.extend({
el: $("#schedule-holder"),
initialize: function() {
this.schedule = new ScheduleList();
this.schedule.query = new Parse.Query(Schedule);
this.schedule.query.ascending("date");
this.schedule.query.limit('500');
this.schedule.fetch();
this.schedule.js = this.schedule.toJSON();
this.render;
},
render: function() {
var template = Handlebars.compile($("#schedule-item").html());
$(this.el).html(template({shows: this.schedule.toJSON()}));
return this;
}
});
var App = new ScheduleView().render();
Chrome schedule.toJSON(); ... , backbone.js, ( , ). , Zepto.js, jQuery.
!