dojox/app/View (version 1.10)

dijit/_TemplatedMixin, dijit/_WidgetsInTemplateMixin, dijit/Destroyable, dojox/app/ViewBase

Summary

View class inheriting from ViewBase adding templating & globalization capabilities.

Usage

var foo = new View(params);
dojox/app/View
Parameter Type Description
params undefined

view parameters, include:

  • app: the app
  • id: view id
  • name: view name
  • template: view template identifier. If templateString is not empty, this parameter is ignored.
  • templateString: view template string
  • controller: view controller module identifier
  • parent: parent view
  • children: children views
  • nls: nls definition module identifier

See the dojox/app/View reference documentation for more information.

Property Summary

  • _attachEventsList of connections associated with data-dojo-attach-event=... in the template
  • _attachPointsList of widget attribute names associated with data-dojo-attach-point=... in the template, ex: ["containerNode", "labelNode"]
  • _earlyTemplatedStartupA fallback to preserve the 1.0 - 1.3 behavior of children in templates having their startup called before the parent widget fires postCreate.
  • _renderedNot normally use, but this flag can be set by the app if the server has already rendered the template, i.e. already inlining the template for the widget into the main page.
  • _skipNodeCache
  • attachScopeObject to which attach points and events will be scoped.
  • contextRequireUsed to provide a context require to the dojo/parser in order to be able to use relative MIDs (e.g. ./Widget) in the widget's template.
  • searchContainerNode
  • templatePathPath to template (HTML file) for this widget relative to dojo.baseUrl.
  • templateStringA string that represents the widget template.
  • widgetsInTemplateShould we parse the template to find widgets that might be declared in markup inside it? (Remove for 2.0 and assume true)

Method Summary

  • _attach(node,type,func) Roughly corresponding to dojo/on, this is the default function for processing a data-dojo-attach-event.
  • _attachTemplateNodes(rootNode) Iterate through the dom nodes and attach functions and nodes accordingly.
  • _beforeFillContent()
  • _createDataStore() Create data store instance for View specific stores
  • _detachTemplateNodes() Detach and clean up the attachments made in _attachtempalteNodes.
  • _escapeValue(val) Escape a value to be inserted into the template, either into an attribute value (ex: foo="${bar}") or as inner text of an element (ex: ${foo})
  • _fillContent(source) Relocate source contents to templated container node. this.containerNode must be able to receive children, or exceptions will be thrown.
  • _initViewHidden()
  • _loadTemplate() load view HTML template and dependencies.
  • _loadViewController() Load view controller by configuration or by default.
  • _processTemplateNode(baseNode,getAttrFunc,attachFunc) Process data-dojo-attach-point and data-dojo-attach-event for given node or widget.
  • _setupModel() Load views model if it is not already loaded then call _startup.
  • _startLayout() startup widgets in view template.
  • _startup() startup widgets in view template.
  • _stringRepl(tmpl) Does substitution of ${foo} type properties in template string
  • afterActivate() view life cycle afterActivate()
  • afterDeactivate() view life cycle afterDeactivate()
  • beforeActivate() view life cycle beforeActivate()
  • beforeDeactivate() view life cycle beforeDeactivate()
  • buildRendering() Construct the UI for this widget from a template, setting this.domNode.
  • connect(obj,event,method)
  • destroy(preserveDom) Destroy this class, releasing any resources registered via own().
  • destroyRendering()
  • init() view life cycle init()
  • load()
  • own() Track specified handles and remove/destroy them when this instance is destroyed, unless they were already removed/destroyed manually.
  • start() start view object. load view template, view controller implement and startup all widgets in view template.
  • startup()

Properties

_attachEvents
Defined by: dijit/_AttachMixin

List of connections associated with data-dojo-attach-event=... in the template

_attachPoints
Defined by: dijit/_AttachMixin

List of widget attribute names associated with data-dojo-attach-point=... in the template, ex: ["containerNode", "labelNode"]

_earlyTemplatedStartup

A fallback to preserve the 1.0 - 1.3 behavior of children in templates having their startup called before the parent widget fires postCreate. Defaults to 'false', causing child widgets to have their .startup() called immediately before a parent widget .startup(), but always after the parent .postCreate(). Set to 'true' to re-enable to previous, arguably broken, behavior.

_rendered
Defined by: dijit/_TemplatedMixin

Not normally use, but this flag can be set by the app if the server has already rendered the template, i.e. already inlining the template for the widget into the main page. Reduces _TemplatedMixin to just function like _AttachMixin.

_skipNodeCache
Defined by: dijit/_TemplatedMixin
attachScope
Defined by: dijit/_AttachMixin

Object to which attach points and events will be scoped. Defaults to 'this'.

contextRequire

Used to provide a context require to the dojo/parser in order to be able to use relative MIDs (e.g. ./Widget) in the widget's template.

searchContainerNode
Defined by: dijit/_TemplatedMixin
templatePath
Defined by: dijit/_TemplatedMixin

Path to template (HTML file) for this widget relative to dojo.baseUrl. Deprecated: use templateString with require([... "dojo/text!..."], ...) instead

templateString
Defined by: dijit/_TemplatedMixin

A string that represents the widget template. Use in conjunction with dojo.cache() to load from a file.

widgetsInTemplate

Should we parse the template to find widgets that might be declared in markup inside it? (Remove for 2.0 and assume true)

Methods

_attach(node,type,func)
Defined by dijit/_AttachMixin

Roughly corresponding to dojo/on, this is the default function for processing a data-dojo-attach-event. Meant to attach to DOMNodes, not to widgets.

Parameter Type Description
node DOMNode

The node to setup a listener on.

type String

Event name like "click".

func undefined
Returns:undefined
_attachTemplateNodes(rootNode)
Defined by dijit/_AttachMixin

Iterate through the dom nodes and attach functions and nodes accordingly.

Map widget properties and functions to the handlers specified in the dom node and it's descendants. This function iterates over all nodes and looks for these properties:

  • dojoAttachPoint/data-dojo-attach-point
  • dojoAttachEvent/data-dojo-attach-event
Parameter Type Description
rootNode DomNode

The node to search for properties. All descendants will be searched.

_beforeFillContent()
Defined by dijit/_AttachMixin
_createDataStore()
Defined by dojox/app/ViewBase

Create data store instance for View specific stores

_detachTemplateNodes()
Defined by dijit/_AttachMixin

Detach and clean up the attachments made in _attachtempalteNodes.

_escapeValue(val)

Escape a value to be inserted into the template, either into an attribute value (ex: foo="${bar}") or as inner text of an element (ex: ${foo})

Parameter Type Description
val String
Returns:undefined
_fillContent(source)

Relocate source contents to templated container node. this.containerNode must be able to receive children, or exceptions will be thrown.

Parameter Type Description
source DomNode
_initViewHidden()
Defined by dojox/app/ViewBase
_loadTemplate()
Defined by dojox/app/View

load view HTML template and dependencies.

Returns:boolean
_loadViewController()
Defined by dojox/app/ViewBase

Load view controller by configuration or by default.

Returns:instance
_processTemplateNode(baseNode,getAttrFunc,attachFunc)
Defined by dijit/_AttachMixin

Process data-dojo-attach-point and data-dojo-attach-event for given node or widget. Returns true if caller should process baseNode's children too.

Parameter Type Description
baseNode DOMNode | Widget
getAttrFunc Function

Function to get the specified property for a given DomNode/Widget.

attachFunc Function
Optional

Attaches an event handler from the specified node/widget to specified function.

Returns:boolean
_setupModel()
Defined by dojox/app/ViewBase

Load views model if it is not already loaded then call _startup.

_startLayout()
Defined by dojox/app/ViewBase

startup widgets in view template.

_startup()
Defined by dojox/app/View

startup widgets in view template.

_stringRepl(tmpl)

Does substitution of ${foo} type properties in template string

Parameter Type Description
tmpl undefined
Returns:undefined
afterActivate()
Defined by dojox/app/ViewBase

view life cycle afterActivate()

afterDeactivate()
Defined by dojox/app/ViewBase

view life cycle afterDeactivate()

beforeActivate()
Defined by dojox/app/ViewBase

view life cycle beforeActivate()

beforeDeactivate()
Defined by dojox/app/ViewBase

view life cycle beforeDeactivate()

buildRendering()

Construct the UI for this widget from a template, setting this.domNode.

connect(obj,event,method)
Defined by dojox/app/View
Parameter Type Description
obj undefined
event undefined
method undefined
Returns:undefined
destroy(preserveDom)
Defined by dijit/Destroyable

Destroy this class, releasing any resources registered via own().

Parameter Type Description
preserveDom Boolean
destroyRendering()
Defined by dijit/_AttachMixin
init()
Defined by dojox/app/ViewBase

view life cycle init()

load()
Defined by dojox/app/View
Returns:instance
own()
Defined by dijit/Destroyable

Track specified handles and remove/destroy them when this instance is destroyed, unless they were already removed/destroyed manually.

Returns:any | undefined

The array of specified handles, so you can do for example:

var handle = this.own(on(...))[0];
start()
Defined by dojox/app/ViewBase

start view object. load view template, view controller implement and startup all widgets in view template.

Returns:function | instance

start view object. load view template, view controller implement and startup all widgets in view template.

startup()
Error in the documentation? Can’t find what you are looking for? Let us know!