Chris
02/25/2022, 8:42 PMinitialize
method twice. I'm sure it's something dumb I've done but I can't see it. Has anyone listening banged their head on this one and remember what it was?Caleb Evans
02/25/2022, 8:53 PMinitialize
method will re-run whenever the parent view renders. The only way to solve is to cache the child view instance (within the childViews
object in the parent view) rather than instantiating a new child view instance every time.
For example, in the parent view, change this:
childViews: {
'My.Child': function() {
return new MyChildView();
}
}
To something like this:
initialize: function () {
this.myChildView = new MyChildView();
},
childViews: {
'My.Child': function() {
return this.myChildView;
}
}
As a reference, the ListHeader view is often implemented in this way, if you look for usages of that throughout SCA core.Chris
02/25/2022, 8:55 PM