Class: SC.FormView
Extends
SC.View.
FormView lays out rows, manages their label widths, binds their
content properties, and sets up their contentValueKeys
as needed. This class is
experimental and not available out of the box.
Usually, you will place rows into the FormView:
childViews: "fullName gender".w(),
contentBinding: 'MyApp.personController',
fullName: SC.FormView.row("Name:", SC.TextFieldView.extend({
layout: {height: 20, width: 150}
})),
gender: SC.FormView.row("Gender:", SC.RadioView.design({
layout: {width: 150, height: 40, centerY: 0},
items: ["male", "female"]
}))
The name of the row (ie. 'fullName'), is passed down to the fields, and used as the key
to bind the value property to the content. In this case it will bind content.fullName to the
value property of the textFieldView
.
Defined in: form.js
Field Summary
- Fields borrowed from SC.View:
- acceptsFirstResponder, acceptsMultitouch, ariaHidden, ariaRole, attributeBindings, autoMixins, backgroundColor, childViewLayout, childViewLayoutOptions, childViews, childViewsNeedLayout, classNameBindings, classNames, concatenatedProperties, createdByParent, designMode, displayProperties, enabledState, firstKeyView, hasLayout, hasTouch, hasVisibility, isBuildingIn, isBuildingOut, isChildViewLayoutLive, isEnabled, isFixedHeight, isFixedPosition, isFixedSize, isFixedWidth, isKeyResponder, isTextSelectable, isView, isVisible, lastKeyView, layerLocationNeedsUpdate, layerNeedsUpdate, layout, modeAdjust, nextKeyView, page, pane, parentView, previousKeyView, renderDelegateName, shouldInheritCursor, shouldInheritEnabled, tagName, themeName, toolTip, touchBoundary, transitionAdjust, transitionAdjustOptions, transitionHide, transitionHideOptions, transitionIn, transitionInOptions, transitionOut, transitionOutOptions, transitionShow, transitionShowOptions, useStaticLayout
- Fields borrowed from SC.Responder:
- hasFirstResponder, isFirstResponder, responderContext
- Fields borrowed from SC.Object:
- isDestroyed, isObject, nextProperty, object, property, target, toInvalidate
- Fields borrowed from SC.Observable:
- isObservable
Instance Methods
- createChildViews()
- labelWidthDidChange()
- recalculateLabelWidth()
- rowLabelMeasuredSizeDidChange(row, labelSize)
Field Detail
contentThe content to bind the form to. This content object is passed to all children.
All child views, if added at design time via string-based childViews
array, will get their
contentValueKey
set to their own key. Note that SC.RowView
passes on its contentValueKey
to its
child field, and if its isNested
property is YES
, uses it to find its own content object.
The default padding around items in the form. By default, this comes from the theme.
You can supply your own directly, or override the formRenderDelegate
:
// base it on the existing render delegate
MyTheme.formRenderDelegate = SC.AceTheme.formRenderDelegate.create({
flowSpacing: { left: 5, top: 5, right: 5, bottom: 5 }
});
Rows in the form do not have to be full SC.FormRowView
at design time. They can also be hashes
that get loaded into rows.
Supply a label width to avoid automatically calculating the widths of the labels in the form. Leave null to let SproutCore automatically determine the proper width for the label.
- Default value:
- null
Instance Method Detail
- Parameters:
- row
- labelSize