Created
February 25, 2014 20:55
-
-
Save vojkny/9217544 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// binds to. Override this method to prevent the initial | |
// events, or to add your own initial events. | |
_initialEvents: function(){ | |
- if (this.collection){ | |
- this.listenTo(this.collection, "add", this.addChildView, this); | |
- this.listenTo(this.collection, "remove", this.removeItemView, this); | |
- this.listenTo(this.collection, "reset", this._renderChildren, this); | |
- } | |
+ | |
+ // Bind only after composite view in rendered to avoid adding child views | |
+ // to unexisting itemViewContainer | |
+ this.once('render', function () { | |
+ if (this.collection){ | |
+ this.listenTo(this.collection, "add", this.addChildView, this); | |
+ this.listenTo(this.collection, "remove", this.removeItemView, this); | |
+ this.listenTo(this.collection, "reset", this._renderChildren, this); | |
+ } | |
+ }); | |
+ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment