Skip to content

Instantly share code, notes, and snippets.

@rmoura-92
Created September 12, 2013 16:29
Show Gist options
  • Save rmoura-92/6540353 to your computer and use it in GitHub Desktop.
Save rmoura-92/6540353 to your computer and use it in GitHub Desktop.
collection trigger
initialize: function() {
var self = this;
this.$el.empty();
this.item = new Item({collection:this.collection});
page = App.CurrentView.split('/')[0];
if(page == 'voos') {
this.$el.addClass('flight-items');
}
console.log(this.collection);
/*
child {length: 16, models: Array[16], _byId: Object, _listenerId: "l8", _events: Object…}
_byId: Object
_events: Object
ola: Array[1] <--- IT'S HERE
reset: Array[1]
resultados: Array[1]
sync: Array[1]
updateForm: Array[1]
__proto__: Object
_listenerId: "l8"
length: 16
models: Array[16]
*/
/*
this.listenTo(this.collection, 'destaques', this.renderNews);
this.listenTo(this.collection, 'resultados', function(collection) {
url = page+'/pesquisa/';
Backbone.history.navigate(url, {trigger:false});
self.options.headingRelated.changeTitle('Resultados Pesquisa');
self.renderNews(collection);
});
*/
this.listenTo(this.collection, 'ola', function(collection, options) {
console.log('aqui OLA'); // <--- DOESN'T ENTER HERE
console.log(collection);
});
this.listenTo(this.collection, 'reset', function(collection, options) {
console.log('aqui');
self.options.headingRelated.changeTitle('Resultados Pesquisa');
self.renderNews(collection);
});
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment