Class: module:argos/Fields/EditorField

module:argos/Fields/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 module:argos/Fields/EditorField()

Extends:
Source:

Extends

Members

alwaysUseValue

Properties:
Name Type Description
alwaysUseValue Boolean

Signifies that the field should always be included when the form calls getValues.

Inherited From:
Source:

applyTo

Properties:
Name Type Description
applyTo String

If defined it will use the applyTo string when getting and setting properties from the SData object instead of the property property.

Inherited From:
Source:

attributeMap

Properties:
Name Type Description
Creates Object

a setter map to html nodes, namely:

  • inputValue => inputNode's value attribute
Source:

autoFocus

Properties:
Name Type Description
autoFocus Boolean

Flag to indicate if this field should be focused when the form is shown.

Inherited From:
Source:

containerNode

Properties:
Name Type Description
The HTMLElement

parent container element of the field.

Inherited From:
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:

default

This applies a default value when inserting a new record, the default value is applied after the template entry but before the context and changes are applied.

Note the word default must be in quotes as default is a reserved word in javascript.

Inherited From:
Source:

disabled

Properties:
Name Type Description
disabled Boolean

Indicates the disabled state

Inherited From:
Source:

hidden

Properties:
Name Type Description
hidden Boolean

Indicates the visibility state

Inherited From:
Source:

label

Properties:
Name Type Description
label String

The text that will, by default, show to the left of a field.

Inherited From:
Source:

name

Properties:
Name Type Description
name String

The unique (within the current form) name of the field

Inherited From:
Source:

originalValue

Properties:
Name Type Description
Value String

storage for keeping track of modified/unmodified values. Used in isDirty.

Source:

owner

Properties:
Name Type Description
owner View

View that controls the field.

Inherited From:
Source:

property

Properties:
Name Type Description
property String

The SData property that the field will be bound to.

Inherited From:
Source:

required :Boolean

required should be true if the field requires input. Defaults to false.

Type:
  • Boolean
Source:

type

Properties:
Name Type Description
type String

The registered name of the field that gets mapped in FieldManager when the field is constructed

Inherited From:
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
Overrides:
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:

buildRendering()

Processes this.widgetTemplate or this.contentTemplate

Inherited From:
Source:

clearValue()

Clears the value by passing null to setValue

Overrides:
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.

Overrides:
Source:

enable()

Extends the parent implementation to also call _enableTextElement.

Overrides:
Source:

focus()

Focuses the input for the field

Inherited From:
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

Overrides:
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:

hide()

Sets hidden to true and fires onHide.

Inherited From:
Source:

init()

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

Overrides:
Source:

isDirty() → {Boolean}

Determines if the value has been modified from the default/original state

Overrides:
Source:
Returns:
Type
Boolean

isDisabled() → {Boolean}

Returns the disabled state

Inherited From:
Source:
Returns:
Type
Boolean

isHidden() → {Boolean}

Returns the hidden state

Inherited From:
Source:
Returns:
Type
Boolean

Navigates to the given this.view using the options from createNavigationOptions.

Source:

onChange(field)

Event that fires when the field is changed

Parameters:
Name Type Description
field _Field

The field itself

Inherited From:
Source:

onDisable(field)

Event that fires when the field is disabled

Parameters:
Name Type Description
field _Field

The field itself

Inherited From:
Source:

onEnable(field)

Event that fires when the field is enabled

Parameters:
Name Type Description
field _Field

The field itself

Inherited From:
Source:

onHide(field)

Event that fires when the field is hidden

Parameters:
Name Type Description
field _Field

The field itself

Inherited From:
Source:

onShow(field)

Event that fires when the field is shown

Parameters:
Name Type Description
field _Field

The field itself

Inherited From:
Source:

renderTo(node)

Inserts the field into the given DOM node using dijit Widget placeAt(node) and saves a reference to it to this.containerNode.

Parameters:
Name Type Description
node HTMLElement

Target node to insert the field into

Inherited From:
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

Overrides:
Source:

show()

Sets hidden to false and fires onShow.

Inherited From:
Source:

validate(value)

Extends the parent implementation to use the this.validationValue instead of this.getValue().

Parameters:
Name Type Description
value
Overrides:
Source: