Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flame.FormView creates views too many times #27

Open
jmiettinen opened this issue May 2, 2012 · 0 comments
Open

Flame.FormView creates views too many times #27

jmiettinen opened this issue May 2, 2012 · 0 comments

Comments

@jmiettinen
Copy link
Contributor

All Flame-views inherit from Ember.ContainerView.

In Ember.ContainerView#init there are the following lines:

      if ('string' === typeof viewName) {
        view = get(this, viewName);
        view = this.createChildView(view);
        set(this, viewName, view);
      } else {
        view = this.createChildView(viewName);
      }

Currently, for controls at least, this causes three calls to createChildView: first by the getter, then the direct call to createChildView and at last, the setter also causes a call (see https://github.com/flamejs/flame.js/blob/master/views/form_view.js#L80).

Simply changing control to a normal property does not seem to work ([1]). So on what preconditions am I stepping on and how should this be done correctly?

[1] Simple modification to use simple property instead of a computed property.

        var view = {
            layout: { left: this.get('leftMargin'), right: this.get('rightMargin') },
            layoutManager: Flame.VerticalStackLayoutManager.create({ topMargin: this._focusRingMargin, spacing: 0, bottomMargin: this._focusRingMargin }),
            childViews: ['label', 'control'],
            isVisible: descriptor.get('isVisible') === undefined ? true : descriptor.get('isVisible'),
            label: this._buildLabel(descriptor),
            control: control
        };
        view.control.layout = view.control.layout || {};
        view.control.layout.left = formView.labelWidth + formView.columnSpacing;
        view.control.layout.left.right = formView._focusRingMargin;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant