Class M.SearchBarView
Extends
M.View.
M.SearchBarView defines a prototype of a search bar that can be used inside of a list
view or independently as a plain input field with a search styling.
Defined in: search_bar.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Field Attributes | Field Name and Description |
---|---|
The initial text shown inside the search bar field describing the input or making a suggestion for
input e.g.
|
|
Determines whether the search bar is part of a list view.
|
|
If the search bar belongs to a list view, this property contains this
list view.
|
|
This property specifies the recommended events for this type of view.
|
|
The type of this object.
|
- Fields borrowed from class M.View:
- childViews, computedValue, contentBinding, contentBindingReverse, cssClass, cssClassOnError, cssClassOnInit, cssStyle, events, hasFocus, html, id, isInline, isView, modelId, parentView, triggerActionOnChange, triggerActionOnEnter, triggerActionOnKeyUp, value
Method Attributes | Method Name and Description |
---|---|
This method clears the search bar's value, both in the DOM and within the JS object.
|
|
disable()
This method disables the search bar by setting the disabled property of its
html representation to true.
|
|
enable()
This method enables the search bar by setting the disabled property of its
html representation to false.
|
|
getValue()
This method returns the search bar view's value.
|
|
gotFocus()
This method is called whenever the view gets the focus.
|
|
This method is called whenever the view lost the focus.
|
|
This method is responsible for registering events for view elements and its child views.
|
|
setValue(value, delegateUpdate)
This method sets the text field's value, initiates its re-rendering
and call the delegateValueUpdate().
|
|
setValueFromDOM(evt, event, nextEvent)
This method sets its value to the value it has in its DOM representation
and then delegates these changes to a controller property if the
contentBindingReverse property is set.
|
- Methods borrowed from class M.View:
- addCssClass, attachToObservable, clearHtml, clearValues, computeValue, contentDidChange, delegateValueUpdate, design, getChildViewsAsArray, getIds, getValues, nl2br, removeCssClass, removeCssProperty, renderUpdate, secure, setCssProperty, style, tab2space, theme, themeChildViews
- Methods borrowed from class M.Object:
- bindToCaller, create, destroy, extend, get, include, set
Field Detail
{String}
initialText
The initial text shown inside the search bar field describing the input or making a suggestion for
input e.g. "Please enter your Name."
{Boolean}
isListViewSearchBar
Determines whether the search bar is part of a list view.
{M.ListView}
listView
If the search bar belongs to a list view, this property contains this
list view.
{Array}
recommendedEvents
This property specifies the recommended events for this type of view.
{String}
type
The type of this object.
Method Detail
clearValue()
This method clears the search bar's value, both in the DOM and within the JS object.
disable()
This method disables the search bar by setting the disabled property of its
html representation to true.
enable()
This method enables the search bar by setting the disabled property of its
html representation to false.
{String}
getValue()
This method returns the search bar view's value.
- Returns:
- {String} The search bar view's value.
gotFocus()
This method is called whenever the view gets the focus.
If there is a initial text specified and the value of this search bar field
still equals this initial text, the value is emptied.
lostFocus()
This method is called whenever the view lost the focus.
If there is a initial text specified and the value of this search bar field
is empty, the value is set to the initial text.
registerEvents()
This method is responsible for registering events for view elements and its child views. It
basically passes the view's event-property to M.EventDispatcher to bind the appropriate
events.
It extend M.View's registerEvents method with some special stuff for text field views and
their internal events.
setValue(value, delegateUpdate)
This method sets the text field's value, initiates its re-rendering
and call the delegateValueUpdate().
- Parameters:
- {String} value
- The value to be applied to the text field view.
- {Boolean} delegateUpdate
- Determines whether to delegate this value update to any observer or not.
setValueFromDOM(evt, event, nextEvent)
This method sets its value to the value it has in its DOM representation
and then delegates these changes to a controller property if the
contentBindingReverse property is set.
Additionally call target / action if set.
- Parameters:
- {Object} evt
- The event triggered this method.
- event
- nextEvent