I have a LayoutView
that consists of two regions. These two regions share the same collection/collection-view, the only difference being the API endpoint that the collection calls to.
initialize: function () {
// setup collection for scheduled mailings
this._scheduledView = new MailingsCollectionView({
collection: new MailingsCollection()
});
this._scheduledView.collection.url = '/api/mailings?is_scheduled=true&mailing_types=m';
// setup collection for sent mailings
this._sentView = new MailingsCollectionView({
collection: new MailingsCollection()
});
this._sentView.collection.url = '/api/mailings?mailing_statuses=c&mailing_types=m';
this.listenTo(this._scheduledView.collection, 'change:checked', this.setMailing)
},
Instead of writing the this.listenTo()
line for each region, how can I listenTo the shared collection at one time?