Class M.ToggleView
Extends
M.View.
M.ToggleView defines the prototype of any toggle view. A toggle view accepts exactly
two child views and provides an easy mechanism to toggle between these two views. An
easy example would be to define two different button views that can be toggled, a more
complex scenario would be to define two content views (M.ScrollView) with own child views
and toggle between them.
Defined in: toggle.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Field Attributes | Field Name and Description |
---|---|
States whether the toggle view currently displays its first child view or its second
child view.
|
|
Determines whether to toggle the view on click.
|
|
The type of this object.
|
- Fields borrowed from class M.View:
- childViews, contentBinding, cssClass, cssClassOnError, cssClassOnInit, cssStyle, hasFocus, html, id, isInline, isView, modelId, parentView, triggerActionOnChange, triggerActionOnEnter, triggerActionOnKeyUp, value
Method Attributes | Method Name and Description |
---|---|
This method renders one child view of the toggle view, based on the isInFirstState
property: YES = first child view, NO = second child view.
|
|
This method is called out of the toggleView method.
|
|
This method toggles the child views by first emptying the toggle view's content
and then rendering the next child view by calling renderUpdateChildViews().
|
- Methods borrowed from class M.View:
- addCssClass, attachToObservable, clearHtml, computeValue, contentDidChange, delegateValueUpdate, design, gotFocus, lostFocus, nl2br, removeCssClass, removeCssProperty, renderUpdate, secure, setCssProperty, setValueFromDOM, style, theme, themeChildViews
- Methods borrowed from class M.Object:
- bindToCaller, create, destroy, extend, get, include, set
Field Detail
{Boolean}
isInFirstState
States whether the toggle view currently displays its first child view or its second
child view.
{Boolean}
toggleOnClick
Determines whether to toggle the view on click. This might be useful if the child views
are e.g. buttons.
{String}
type
The type of this object.
Method Detail
renderChildViews()
This method renders one child view of the toggle view, based on the isInFirstState
property: YES = first child view, NO = second child view.
renderUpdateChildViews()
This method is called out of the toggleView method. It basically empties the html
representation of the toggle view and then renders the proper child view based on
the isInFirstState property: YES = first child view, NO = second child view.
toggleView()
This method toggles the child views by first emptying the toggle view's content
and then rendering the next child view by calling renderUpdateChildViews().