Skip to content

Instantly share code, notes, and snippets.

@ppcano
Created October 29, 2011 13:06
Show Gist options
  • Save ppcano/1324425 to your computer and use it in GitHub Desktop.
Save ppcano/1324425 to your computer and use it in GitHub Desktop.
UI Kit View in SC20: appending a new view.
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 $() ) ????
},
@ppcano
Copy link
Author

ppcano commented Oct 29, 2011

is there any other way to handling child views in SC 20?

  1. 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.

  2. 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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment