| Page 1 of 1 | [ 4 posts ] |
|
Looking at the source for Y.View
in the initializer there is the following comment: // When the container node changes (or when it's set for the first // time), we'll attach events to it, but not until then. This allows the // container to be created lazily the first time it's accessed rather // than always on init. this.after('containerChange', this._afterContainerChange); The wording 'changes' is what I am getting at. However the ATTRS for container are: container: { getter : '_getContainer', setter : Y.one, writeOnce: true } Why is the container a writeOnce attribute? In my application I want to use a nested (subview). when the parent view changes, I want to update the container for the subview so I dont have to keep creating a new subview. But I cant! I guess there is some rational behind this which I would be interested in finding out, otherwise lets remove the writeOnce! Thanks, Richard. |
|
I briefly had some code in View that allowed the container to change after init. This worked great, but it introduced some complexity for Y.App that we weren't sure was worthwhile, so I reverted the change and made container writeOnce again.
This is good feedback, though. It's clear that people would find it useful to be able to change the container after init, so we'll look into bringing that functionality back. |
|
Well I had filed a Bug with the same thing and after some discussion it go closed. As I worked more with Y.View I realized that having it writeOnce is actually a good strategy.
Even though you can not set the container after init, you can almost certainly do this.get('container').setHTML(Subview.render().get('container')) as many times as you want. |
|
Ok, I am not sure why you decided it is actually a good strategy - could you explain? Also Im not sure my scenario relates to this.get('container').setHTML(Subview.render().get('container')) ?
I have a re-usable bit of the display that is rendered as a mini view and its container is a div within a larger view. There a number of larger views that want to contain this mini view, and so if the main page view changes, then the original container is lost and If I cannot change the container for the mini view, I would need to destroy, create new and restore state onto the newly available container. |
| Page 1 of 1 | [ 4 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group