dojox/app/controllers/Load (version 1.10)

dojox/app/Controller

Usage

var foo = new Load(app,events);
dojox/app/controllers/Load
Parameter Type Description
app undefined

dojox/app application instance.

events undefined

{event : handler}

Property Summary

Method Summary

  • _getViewNamesFromDefaults(view) Build the full nested view name from the view and its defaultView(s)
  • bind(evented,event,handler) Bind event on dojo/Evented instance, document, domNode or window.
  • createChild(parent,childId,subIds,params) Create a view instance if not already loaded by calling createView.
  • createView(parent,id,name,mixin,params,type) Create a dojox/app/View instance.
  • init(event)
  • load(event) Response to dojox/app "loadArray" event.
  • loadChild(parent,childId,subIds,params,loadEvent) Load child and sub children views recursively.
  • loadView(loadEvent) Response to dojox/app "app-load" event.
  • proceedLoadView(loadEvt) Proceed load queue by FIFO by default.
  • unbind(evented,event) remove a binded event signal.

Properties

_waitingQueue

Methods

_getViewNamesFromDefaults(view)

Build the full nested view name from the view and its defaultView(s)

Parameter Type Description
view Object

the view with defaultViews to process

Returns:any | undefined

A string with the full nested view names

bind(evented,event,handler)

Bind event on dojo/Evented instance, document, domNode or window. Save event signal in controller instance. If no parameter is provided automatically bind all events registered in controller events property.

Parameter Type Description
evented Object

dojo/Evented instance, document, domNode or window

event String

event

handler Function

event handler

Returns:function

Bind event on dojo/Evented instance, document, domNode or window. Save event signal in controller instance. If no parameter is provided automatically bind all events registered in controller events property.

createChild(parent,childId,subIds,params)

Create a view instance if not already loaded by calling createView. This is typically a dojox/app/View.

Parameter Type Description
parent Object

parent of the view.

childId String

view id need to be loaded.

subIds String

sub views' id of this view.

params undefined
Returns:any | undefined | instance

If view exist, return the view object. Otherwise, create the view and return a dojo.Deferred instance.

createView(parent,id,name,mixin,params,type)

Create a dojox/app/View instance. Can be overridden to create different type of views.

Parameter Type Description
parent Object

parent of this view.

id String

view id.

name String

view name.

mixin String

additional property to be mixed into the view (templateString, controller...)

params Object

params of this view.

type String

the MID of the View. If not provided "dojox/app/View".

Returns:any | instance

A dojo/Deferred instance which will be resolved when the view will be instantiated.

init(event)
Parameter Type Description
event undefined
load(event)

Response to dojox/app "loadArray" event.

Parameter Type Description
event Object

LoadArray event parameter. It should be like this: {"parent":parent, "viewId":viewId, "viewArray":viewArray, "callback":function(){...}}

Returns:any | undefined

A dojo/Deferred object. The return value cannot return directly. If the caller need to use the return value, pass callback function in event parameter and process return value in callback function.

Examples

Example 1

Use trigger() to trigger "loadArray" event, and this function will response the event. For example:

this.trigger("app-load", {"parent":parent, "viewId":viewId, "viewArray":viewArray, "callback":function(){...}});
loadChild(parent,childId,subIds,params,loadEvent)

Load child and sub children views recursively.

Parameter Type Description
parent Object

parent of this view.

childId String

view id need to be loaded.

subIds String

sub views' id of this view.

params Object

params of this view.

loadEvent Object

the event passed for the load of this view.

Returns:any | undefined

A dojo/Deferred instance which will be resolved when all views loaded.

loadView(loadEvent)

Response to dojox/app "app-load" event.

Parameter Type Description
loadEvent Object

Load event parameter. It should be like this: {"parent":parent, "viewId":viewId, "callback":function(){...}}

Returns:any | undefined

A dojo/Deferred object. The return value cannot return directly. If the caller need to use the return value, pass callback function in event parameter and process return value in callback function.

Examples

Example 1

Use trigger() to trigger "app-load" event, and this function will response the event. For example:

this.trigger("app-load", {"parent":parent, "viewId":viewId, "callback":function(){...}});
proceedLoadView(loadEvt)

Proceed load queue by FIFO by default. If load is in proceeding, add the next load to waiting queue.

Parameter Type Description
loadEvt Object

LoadArray event parameter. It should be like this: {"parent":parent, "viewId":viewId, "viewArray":viewArray, "callback":function(){...}}

unbind(evented,event)

remove a binded event signal.

Parameter Type Description
evented Object

dojo/Evented instance, document, domNode or window

event String

event

Returns:function

remove a binded event signal.

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