Class: View

View()

View is the root Class for all views and incorporates all the base features, events, and hooks needed to successfully render, hide, show, and transition. All Views are dijit Widgets, namely utilizing its: widgetTemplate, connections, and attributeMap

Constructor

new View()

Source:

Members

app

A reference to the globa App object
Source:

attributeMap

This map provides quick access to HTML properties, most notably the selected property of the container
Source:

errorHandlers

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

errorText

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

HTTP_STATUS

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

id

The id is used to uniquely define a view and is used in navigating, history and for HTML markup.
Properties:
Type Description
String
Source:

modelName

Registered model name to use.
Source:

route

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

security

May be defined along with Application hasAccessTo to incorporate View restrictions.
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
Source:

titleText

The titleText string will be applied to the top toolbar during show.
Source:

tools

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

viewType

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

widgetTemplate

The widgetTemplate is a Simplate that will be used as the main HTML markup of the View.
Properties:
Type Description
Simplate
Source:

Methods

beforeTransitionAway()

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

beforeTransitionTo()

Called before the view is transitioned (slide animation complete) to.
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.
Source:
Returns:
Type
String

createErrorHandlers() → {Array}

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

createToolLayout() → {Object}

Returns the tool layout that defines all toolbar items for the view
Source:
Returns:
The toolbar layout
Type
Object

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.
Source:
Returns:
String expression.
Type
String

getContext() → {Object}

Returns the context of the view which is a small summary of key properties.
Source:
Returns:
Vital View properties.
Type
Object

getErrorMessage()

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

getModel()

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

getOptionsContext() → {Object}

Returns the options used for the View getContext().
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.
Source:

getSecurity(access)

Returns the defined security.
Parameters:
Name Type Description
access
Source:

getService() → {Object}

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

getTools() → {Object}

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

handleError(error)

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

init()

Called on loading of the application.
Source:

initConnects()

Establishes this views connections to various events
Source:

initModel()

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

isDisabled() → {Boolean}

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

load()

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

onActivate(self)

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

onBeforeTransitionAway(self)

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

onBeforeTransitionTo(self)

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

onShow(self)

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

onToolLayoutCreated()

Called after toolBar layout is created;
Source:

onTransitionAway(self)

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

onTransitionTo(self)

The onTransitionTo event.
Parameters:
Name Type Description
self
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.
Source:

refresh()

Should refresh the view, such as but not limited to: Emptying nodes, requesting data, rendering new content
Source:

refreshRequiredFor(options) → {Boolean}

Called in show() before route is invoked.
Parameters:
Name Type Description
options Object Navigation options passed from the previous view.
Source:
Returns:
True indicates view needs to be refreshed.
Type
Boolean

routeLoad(ctx, next)

Fires first when a route is triggered. Any pre-loading should happen here.
Parameters:
Name Type Description
ctx Object
next function
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
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.
Source:

transitionAway()

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

transitionTo()

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