Running a backbone app with a structured view system, here's a simplified version of how it looks:
NewsListView = Backbone.View.extend({
el: $('li#newspane'),
initialize: function() {
_.bindAll(this);
},
render: function() {
},
reset: function(){
}
});
FilterView = Backbone.View.extend({
el: $('li.filter'),
initialize: function() {
},
render: function() {
},
toggleFilter: function() {
}
});
AllView = Backbone.View.extend({
initialize: function() {
this.newsListView = new NewsListView();
this.filterView = new FilterView();
}
});
In essence, when the toggleFilter()
function in FilterView
is activated, I want to trigger an event named filtered
which can then be captured by NewsListView
, leading to its reset()
function being called. I'm unsure how to achieve this without directly passing a NewsListView
object reference to FilterView
. Any suggestions?