Class: Edit

Edit()

new Edit()

Source:
Requires:
  • module:crm.Format
  • module:crm.Validator

Extends

Requires

  • module:crm.Format
  • module:crm.Validator

Members

app

A reference to the globa App object
Inherited From:
Source:

attributeMap

Properties:
Name Type Description
Creates Object a setter map to html nodes, namely: * validationContent => validationContentNode's innerHTML
Inherited From:
Source:

cancelTooltipText

Properties:
Name Type Description
Text String shown in the top toolbar cancel button
Inherited From:
Source:

concurrencyErrorText

Properties:
Name Type Description
Text String alerted to user when the data has been updated since they last fetched the data.
Inherited From:
Source:

concurrencySummaryItemTemplate

Properties:
Name Type Description
* Simplate `$` => validation error object
Inherited From:
Source:

concurrencySummaryTemplate

Properties:
Name Type Description
HTML Simplate for the concurrency error area, this div is shown/hidden as needed. `$` => the view instance
Inherited From:
Source:

concurrencySummaryText

Inherited From:
Source:

customizationSet

Properties:
Name Type Description
The String customization identifier for this class. When a customization is registered it is passed a path/identifier which is then matched to this property.
Inherited From:
Source:

detailsText

Properties:
Name Type Description
Default String text used in the section header
Inherited From:
Source:

diffPropertyIgnores

Array of strings that will get ignored when the diffing runs.
Inherited From:
Source:

enableCustomizations

Inherited From:
Source:

entry

Properties:
Name Type Description
The Object saved data response.
Inherited From:
Source:

errorHandlers

Properties:
Name Type Description
errorHandlers Array Array of objects that should contain a name string property, test function, and handle function.
Inherited From:
Source:

errorText

Properties:
Name Type Description
Localized Object error messages. One general error message, and messages by HTTP status code.
Inherited From:
Source:

expose

Inherited From:
Source:

fields

Properties:
Name Type Description
Collection Object of the fields in the layout where the key is the `name` of the field.
Inherited From:
Source:

HTTP_STATUS

Properties:
Name Type Description
Http Object Error Status codes. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
Inherited From:
Source:

id

Inherited From:
Source:

inserting

Properties:
Name Type Description
Flags Boolean if the view is in "insert" (create) mode, or if it is in "update" (edit) mode.
Inherited From:
Source:

insertSecurity

Inherited From:
Source:

layout

Properties:
Name Type Description
The Object layout definition that constructs the detail view with sections and rows
Inherited From:
Source:

loadingTemplate

Properties:
Name Type Description
HTML Simplate shown when data is being loaded. `$` => the view instance
Inherited From:
Source:

loadingText

Properties:
Name Type Description
Text String shown while the view is loading.
Inherited From:
Source:

modelName

Registered model name to use.
Inherited From:
Source:

multiColumnClass

Properties:
Name Type Description
SoHo string class to be applied on multi column.
Inherited From:
Source:

multiColumnCount

Properties:
Name Type Description
Number number of columns in view
Inherited From:
Source:

multiColumnView

Properties:
Name Type Description
Flags Boolean if the view is multi column or single column.
Inherited From:
Source:

propertyTemplate

Properties:
Name Type Description
HTML Simplate created for each property (field row). * `$` => the field row object defined in createLayout. * `$$` => the view instance
Inherited From:
Source:

route

Properties:
Name Type Description
Route String passed into the router. RegEx expressions are also accepted.
Inherited From:
Source:

saveText

Inherited From:
Deprecated:
  • Yes
Source:

saveTooltipText

Properties:
Name Type Description
Text String shown in the top toolbar save button
Inherited From:
Source:

sectionBeginTemplate

Properties:
Name Type Description
HTML Simplate that starts a new section including the collapsible header `$` => the view instance
Inherited From:
Source:

sectionEndTemplate

Properties:
Name Type Description
HTML Simplate that ends a section `$` => the view instance
Inherited From:
Source:

security

May be defined along with Application hasAccessTo to incorporate View restrictions.
Inherited From:
Source:

serviceName

May be used to specify the service name to use for data requests. Setting false will force the use of the default service.
Properties:
Type Description
String/Boolean
Inherited From:
Source:

titleText

Inherited From:
Source:

toggleCollapseText

Properties:
Name Type Description
ARIA String label text for a collapsible section header
Inherited From:
Source:

tools

This views toolbar layout that defines all toolbar items in all toolbars.
Properties:
Type Description
Object
Inherited From:
Source:

updateSecurity

Inherited From:
Source:

validationSummaryItemTemplate

Properties:
Name Type Description
HTML Simplate shown when data is being loaded. * `$` => validation error object * `$$` => field instance that the error is on
Inherited From:
Source:

validationSummaryTemplate

Properties:
Name Type Description
HTML Simplate for the validation summary area, this div is shown/hidden as needed. `$` => the view instance
Inherited From:
Source:

validationSummaryText

Inherited From:
Source:

viewType

View type (detail, edit, list, etc)
Inherited From:
Source:

widgetTemplate

Properties:
Name Type Description
The Simplate template used to render the view's main DOM element when the view is initialized. This template includes loadingTemplate and validationSummaryTemplate. The default template uses the following properties: name description ---------------------------------------------------------------- id main container div id title main container div title attr cls additional class string added to the main container div resourceKind set to data-resource-kind
Inherited From:
Source:

Methods

_onDisableField(field)

Handler for a fields on disable event. Adds the row-disabled css class.
Parameters:
Name Type Description
field _Field Field instance that is being disabled
Inherited From:
Source:

_onEnableField(field)

Handler for a fields on enable event. Removes the row-disabled css class.
Parameters:
Name Type Description
field _Field Field instance that is being enabled
Inherited From:
Source:

_onHideField(field)

Handler for a fields on hide event. Adds the row-hidden css class.
Parameters:
Name Type Description
field _Field Field instance that is being hidden
Inherited From:
Source:

_onShowField(field)

Handler for a fields on show event. Removes the row-hidden css class.
Parameters:
Name Type Description
field _Field Field instance that is being shown
Inherited From:
Source:

activate()

Empties the activate method which prevents detection of refresh from transititioning. External navigation (browser back/forward) never refreshes the edit view as it's always a terminal loop. i.e. you never move "forward" from an edit view; you navigate to child editors, from which you always return.
Inherited From:
Source:

applyFieldDefaults()

Loops all the fields looking for any with the `default` property set, if set apply that value as the initial value of the field. If the value is a function, its expanded then applied.
Inherited From:
Source:

beforeTransitionAway()

Called before the view is transitioned (slide animation complete) away from.
Inherited From:
Source:

beforeTransitionTo()

Extends beforeTransitionTo to add the loading styling if refresh is needed
Inherited From:
Source:

buildRoute() → {String}

Show method calls this to build a route that it can navigate to. If you add a custom route, this should change to build a route that can match that.
Inherited From:
Source:
Returns:
Type
String

clearValues()

Loops all fields and calls its `clearValue()`.
Inherited From:
Source:

convertEntry(entry) → {Object}

Pre-processes the entry before processEntry runs.
Parameters:
Name Type Description
entry Object data
Inherited From:
Source:
Returns:
entry with actual Date objects
Type
Object

convertValues()

Function to call to tranform values before save
Inherited From:
Source:

createEntryForInsert(values) → {Object}

Takes the values object and adds the needed propertiers for creating/inserting.
Parameters:
Name Type Description
values Object
Inherited From:
Source:
Returns:
Object with properties for inserting
Type
Object

createEntryForUpdate(values) → {Object}

Takes the values object and adds the needed propertiers for updating.
Parameters:
Name Type Description
values Object
Inherited From:
Source:
Returns:
Object with properties for updating
Type
Object

createErrorHandlers() → {Array}

Inherited From:
Source:
Returns:
Returns an array of error handlers
Type
Array

createItem() → {Object}

Gathers the values for the entry to send back and returns the appropriate payload for creating or updating.
Inherited From:
Source:
Returns:
Entry/payload
Type
Object

createLayout() → {Array.<Object>}

Sets and returns the Edit view layout by following a standard for section and field: The `this.layout` itself is an array of section objects where a section object is defined as such: { name: 'String', // Required. unique name for identification/customization purposes title: 'String', // Required. Text shown in the section header children: [], // Array of child row objects } A child row object has: { name: 'String', // Required. unique name for identification/customization purposes property: 'String', // Optional. The property of the current entity to bind to label: 'String', // Optional. Text shown in the label to the left of the property type: 'String', // Required. The field type as registered with the FieldManager. // Examples of type: 'text', 'decimal', 'date', 'lookup', 'select', 'duration' 'default': value // Optional. If defined the value will be set as the default "unmodified" value (not dirty). } All further properties are set by their respective type, please see the individual field for its configurable options.
Inherited From:
Source:
Returns:
Edit layout definition
Type
Array.<Object>

createToolLayout() → {Object}

Sets and returns the toolbar item layout definition, this method should be overriden in the view so that you may define the views toolbar items. By default it adds a save button bound to `this.save()` and cancel that fires `ReUI.back()`
Inherited From:
Source:
Returns:
this.tools
Type
Object

diffs()

Diffs the results from the current values and the previous values. This is done for a concurrency check to indicate what has changed.
Inherited From:
Source:
Returns:
Array List of property names that have changed

disable()

Disables the form by setting busy to true and disabling the toolbar.
Inherited From:
Source:

enable()

Enables the form by setting busy to false and enabling the toolbar
Inherited From:
Source:

expandExpression(expression) → {String}

Expands the passed expression if it is a function.
Parameters:
Name Type Description
expression String/Function Returns string directly, if function it is called and the result returned.
Inherited From:
Source:
Returns:
String expression.
Type
String

getContext()

Extends the getContext function to also include the `resourceKind` of the view, `insert` state and `key` of the entry (false if inserting)
Inherited From:
Source:

getErrorMessage()

Gets the general error message, or the error message for the status code.
Inherited From:
Source:

getModel()

Returns a new instance of a model for the view.
Inherited From:
Source:

getOptionsContext() → {Object}

Returns the options used for the View getContext().
Inherited From:
Source:
Returns:
Options to be used for context.
Type
Object

getRoute()

Gets the route associated with this view. Returns this.id if no route is defined.
Inherited From:
Source:

getSecurity(access)

Wrapper for detecting security for update mode or insert mode
Parameters:
Name Type Description
access String Can be either "update" or "insert"
Inherited From:
Source:

getService() → {Object}

Returns the primary SDataService instance for the view.
Inherited From:
Source:
Returns:
The Sage.SData.Client.SDataService instance.
Type
Object

getTag() → {String}

Returns the view key
Inherited From:
Source:
Returns:
View key
Type
String

getTools() → {Object}

Called from Applications view transition handler and returns the fully customized toolbar layout.
Inherited From:
Source:
Returns:
The toolbar layout
Type
Object

getValues(all) → {Object}

Retrieves the value from every field, skipping the ones excluded, and merges them into a single payload with the key being the fields `property` attribute, taking into consideration `applyTo` if defined. If all is passed as true, it also grabs hidden and unmodified (clean) values.
Parameters:
Name Type Description
all Boolean True to also include hidden and unmodified values.
Inherited From:
Source:
Returns:
A single object payload with all the values.
Type
Object

handleError(error)

Starts matching and executing errorHandlers.
Parameters:
Name Type Description
error Error Error to pass to the errorHandlers
Inherited From:
Source:

hasAction(name, evt, node) → {Boolean}

Determines if a field has defined on it the supplied name as a function
Parameters:
Name Type Description
name String Name of the function to test for
evt Event The original click/tap event
node HTMLElement The node that initiated the event
Inherited From:
Source:
Returns:
If the field has the named function defined
Type
Boolean

hideConcurrencySummary()

Removes teh summary for concurrency errors
Inherited From:
Source:

hideValidationSummary()

Removes the summary validation visible styling and empties its contents of error markup
Inherited From:
Source:

init()

Extends init to also init the fields in `this.fields`.
Inherited From:
Source:

initConnects()

Establishes this views connections to various events
Inherited From:
Source:

initModel()

Initializes the model instance that is returned with the current view.
Inherited From:
Source:

insert()

Called by save() when performing an insert (create). Gathers the values, creates the payload for insert, creates the sdata request and calls `create`.
Inherited From:
Source:

invokeAction(name, parameters, evt, node) → {function}

Extends invokeAction to first look for the specified function name on the field instance first before passing it to the view.
Parameters:
Name Type Description
name String Name of the function to invoke
parameters Object Parameters of the function to be passed
evt Event The original click/tap event
node HTMLElement The node that initiated the event
Inherited From:
Source:
Returns:
Either calls the fields action or returns the inherited version which looks at the view for the action
Type
function

isDisabled() → {Boolean}

Returns true if view is disabled.
Inherited From:
Source:
Returns:
.
Type
Boolean

isFormDisabled() → {Boolean}

Determines if the form is currently busy/disabled
Inherited From:
Source:
Returns:
Type
Boolean

load()

Called once the first time the view is about to be transitioned to.
Inherited From:
Deprecated:
  • Yes
Source:

onActivate(self)

The onActivate event.
Parameters:
Name Type Description
self
Inherited From:
Source:

onBeforeTransitionAway(self)

The onBeforeTransitionAway event.
Parameters:
Name Type Description
self
Inherited From:
Source:

onBeforeTransitionTo(self)

The onBeforeTransitionTo event.
Parameters:
Name Type Description
self
Inherited From:
Source:

onInsertCompleted(entry)

Handler for insert complete, checks for `this.options.returnTo` else it simply goes back.
Parameters:
Name Type Description
entry
Inherited From:
Source:

onShow(self)

The onShow event.
Parameters:
Name Type Description
self
Inherited From:
Source:

onToolLayoutCreated()

Called after toolBar layout is created;
Inherited From:
Source:

onTransitionAway(self)

The onTransitionAway event.
Parameters:
Name Type Description
self
Inherited From:
Source:

onTransitionTo(self)

The onTransitionTo event.
Parameters:
Name Type Description
self
Inherited From:
Source:

onUpdateCompleted(entry)

Handler for update complete, checks for `this.options.returnTo` else it simply goes back.
Parameters:
Name Type Description
entry
Inherited From:
Source:

open()

Available Options: horizontal: True if the transition is horizontal, False otherwise. reverse: True if the transition is a reverse transition (right/down), False otherwise. track: False if the transition should not be tracked in history, True otherwise. update: False if the transition should not update title and back button, True otherwise. scroll: False if the transition should not scroll to the top, True otherwise.
Inherited From:
Source:

refresh()

Refresh first clears out any variables set to previous data. The mode of the Edit view is set and determined via `this.options.insert`, and the views values are cleared. Lastly it makes the appropiate data request:
Inherited From:
Source:

refreshRequiredFor(options)

Extends refreshRequiredFor to return false if we already have the key the options is passing
Parameters:
Name Type Description
options Object Navigation options from previous view
Inherited From:
Source:

requestData()

Initiates the request.
Inherited From:
Source:

routeLoad(ctx, next)

Fires first when a route is triggered. Any pre-loading should happen here.
Parameters:
Name Type Description
ctx Object
next function
Inherited From:
Source:

routeShow(ctx, next)

Fires second when a route is triggered. Any pre-loading should happen here.
Parameters:
Name Type Description
ctx Object
next function
Inherited From:
Source:

save()

Handler for the save toolbar action. First validates the forms, showing errors and stoping saving if found. Then calls either insert or update based upon `this.inserting`.
Inherited From:
Source:

setValues(values, initial)

Sets the given values by looping the fields and checking if the field property matches a key in the passed values object (after considering a fields `applyTo`). The value set is then passed the initial state, true for default/unmodified/clean and false for dirty or altered.
Parameters:
Name Type Description
values Object data entry, or collection of key/values where key matches a fields property attribute
initial Boolean Initial state of the value, true for clean, false for dirty
Inherited From:
Source:

show(options, transitionOptions)

Shows the view using pagejs in order to transition to the new element.
Parameters:
Name Type Description
options Object The navigation options passed from the previous view.
transitionOptions Object Optional transition object that is forwarded to open.
Inherited From:
Source:

showValidationSummary()

Creates the markup by applying the `validationSummaryItemTemplate` to each entry in `this.errors` then sets the combined result into the summary validation node and sets the styling to visible
Inherited From:
Source:

startup()

When the app is started this fires, the Edit view renders its layout immediately, then renders each field instance. On refresh it will clear the values, but leave the layout intact.
Inherited From:
Source:

transitionAway()

Called after the view has been transitioned (slide animation complete) away from.
Inherited From:
Source:

transitionTo()

Called after the view has been transitioned (slide animation complete) to.
Inherited From:
Source:

update()

Called by save() when performing an update (edit). Gathers the values, creates the payload for update, creates the sdata request and calls `update`.
Inherited From:
Source:

validate() → {Array.<Boolean/Object>}

Loops and gathers the validation errors returned from each field and adds them to the validation summary area. If no errors, removes the validation summary.
Inherited From:
Source:
Returns:
Returns the array of errors if present or false for no errors.
Type
Array.<Boolean/Object>