Created
October 29, 2011 13:06
-
-
Save ppcano/1324425 to your computer and use it in GitHub Desktop.
UI Kit View in SC20: appending a new view.
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
createScrollView: function() { | |
var parentView = this | |
, view = null | |
, childViews = get(parentView, 'childViews') // otherwise return null when parentView.childViews | |
, buffer | |
, fragment; | |
view = parentView.createChildView( SC.View.extend(), { | |
classNames: ['scroll-scroll-view'], | |
elementId: this.scrollerId | |
}); | |
buffer = view.renderToBuffer().string(); | |
fragment = SC.$(buffer); | |
view._notifyWillInsertElement(); | |
parentView.$().append(fragment); | |
childViews.push(view); | |
view._notifyDidInsertElement(); | |
// How can view change its state from inBuffer to inDOM (to access $() ) ???? | |
}, | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
is there any other way to handling child views in SC 20?
it could be easier if a command like: this.createChildView( newView, {}); would complete the process of adding a view and append it to the dom.
Also wondering how the view change its state from inBuffer to inDOM, to be able to access view.$().
Any suggestions/discussions will be really appreciated?