Class: EditorField

EditorField()

The EditorField is not a field per say but a base class for another field type to inherit from. The intent of an EditorField is you have a field where the input should come from another form. EditorField will handle the navigation, gathering values from the other view, going back and applying to the form the field is on. A prime example of an editor field extension would be an AddressField - say you are entering a contacts details and need the address. You could make an AddressField that extends EditorField for handling all the address parts and takes the user to an address_edit with all the street/city/postal etc.

Constructor

new EditorField()

Source:

Extends

  • argos._Field

Members

attributeMap

Properties:
Name Type Description
Creates Object a setter map to html nodes, namely: * inputValue => inputNode's value attribute
Source:

currentValue

Properties:
Name Type Description
Value Object/String/Date/Number storage for current value, as it must be formatted for display this is the full value.
Source:

originalValue

Properties:
Name Type Description
Value String storage for keeping track of modified/unmodified values. Used in isDirty.
Source:

required :Boolean

required should be true if the field requires input. Defaults to false.
Type:
  • Boolean
Source:

validationValue

Properties:
Name Type Description
Value Object/String/Date/Number storage for the value to use in validation, when gathering values from the editor view the validationValue is set using `getValues(true)` which returns all values even non-modified ones.
Source:

view

Source:

widgetTemplate

Properties:
Name Type Description
Simplate Simplate that defines the fields HTML Markup * `$` => Field instance * `$$` => Owner View instance
Source:

Methods

_disableTextElement()

Sets the input nodes' disabled attribute to true
Source:

_enableTextElement()

Sets the input nodes' disabled attribute to false
Source:

_onClick(evt)

Handler for the `onclick` event of the fields container. Invokes navigateToEditView.
Parameters:
Name Type Description
evt Event
Source:

_onComplete()

Handler for `_onComplete` which is fired after the user has completed the form in the editor view Fires onChange.
Source:

clearValue()

Clears the value by passing `null` to setValue
Source:

complete()

Handler for the toolbar item that is passed to the editor view. When this function fires the view shown is the editor view but the function is fired in scope of the field. It gets a handler of the current active view and validates the form, if it passes it gathers the value, sets the fields text, calls `ReUI.back` and fires _onComplete.
Source:

createNavigationOptions()

Creates the navigation options to be passed to the editor view. The important part of this code is that it passes `tools` that overrides the editors view toolbar with an item that operates within this fields scope.
Source:
Returns:
Navigation options

disable()

Extends the parent implementation to also call _disableTextElement.
Source:

enable()

Extends the parent implementation to also call _enableTextElement.
Source:

formatValue(val)

Returns the formatted value. This should be overwritten to provide proper formatting
Parameters:
Name Type Description
val
Source:

getValue() → {Object/String/Date/Number}

Returns the current value
Source:
Returns:
Type
Object/String/Date/Number

getValuesFromView()

Gets the values from the editor view and applies it to the this fields `this.currentValue` and `this.validationValue`.
Source:

init()

Extends the parent implementation to connect the `onclick` event of the fields container to _onClick.
Source:

isDirty() → {Boolean}

Determines if the value has been modified from the default/original state
Source:
Returns:
Type
Boolean
Navigates to the given `this.view` using the options from createNavigationOptions.
Source:

setText(text)

Sets the displayed text to the input.
Parameters:
Name Type Description
text String
Source:

setValue(val, initial)

Sets the current value to the item passed, as the default if initial is true. Then it sets the displayed text using setText with the formatted value. If null/false is passed all is cleared and `this.emptyText` is set as the displayed text.
Parameters:
Name Type Description
val Object/String/Date/Number Value to be set
initial Boolean True if the value is the default/clean value, false if it is a meant as a dirty value
Source:

validate(value)

Extends the parent implementation to use the `this.validationValue` instead of `this.getValue()`.
Parameters:
Name Type Description
value
Source: