Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backbone.marionette cannot adapt backbone 1.2.1 #2628

Closed
KeyHui opened this issue Jun 26, 2015 · 4 comments
Closed

backbone.marionette cannot adapt backbone 1.2.1 #2628

KeyHui opened this issue Jun 26, 2015 · 4 comments

Comments

@KeyHui
Copy link

KeyHui commented Jun 26, 2015

Hi All

backbone.marionette 2.4.2 cannot adapt backbone 1.2.1

thank you

@ianmstew
Copy link
Member

Hi @KeyHui, can you write up a failing test case or show some code that no longer works for you?

@KeyHui
Copy link
Author

KeyHui commented Jun 28, 2015

Hi @ianmstew

Marionette.LayoutView.extend({
initialize:function() {
this.collection = new Backbone.Collection();
// it can work
//this.listenTo(this.collection, 'add', this.addFunc);
},
collectionEvents: {
add: 'addFunc'
},
addFunc: function() {
//it cannot work
console.log('add')
},
onShow: function() {
this.collection.fetch()
}
})

I found that collectionEvents cannot work, but it can work, if I bind collection in initialize

thank you

@paulfalgout
Copy link
Member

This is a dupe of #2605

@ianmstew
Copy link
Member

@KeyHui thanks for clarifying--looks like this is due to a change in Backbone 1.2.1, but does not directly break Marionette documentation. For the time being, you can instead assign the collection in your constructor, like so:

constructor: function () {
  this.collection = new Backbone.Collection();
  Marionette.LayoutView.prototype.constructor.apply(this, arguments);
}

In the meantime, an upcoming enhancement will have the side effect of permitting models and collections to be assigned within initialize while using Backbone 1.2.1: #2605 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants