APIs

Show:

Methods

allowedEvents

() Undefined

This is a function, but what's important is the returned value. 'tabCreated', 'tabDisplayed', 'tabDestroyed', 'destroyed', 'rendered'

Returns:

Undefined:

bindToModel

(
  • [model]
)
Undefined

Binds the view to a Model. will explain more later.

Parameters:

  • [model] awa.mvc.Model | Backbone.Model optional

    Model to bind to

Returns:

Undefined:

createTab

(
  • params
  • $container
)
Undefined

Adds a new tab and view area to the tabbed container view

Parameters:

  • params Object

    This can be either the constructor method or an already constructed view. I'd suggest you construct your view first as it's easier to track any issues.

    • onTabSelect String | Function

      This can be a string location or a function that carries out its own process. It is recommended that you also set a location per Tab.

    • [view] awa.mvc.View | Constructor optional

      View instance that is displayed in tab panel

    • [viewArgs] Array optional

      Arguments applied to the view class

    • [title] String optional

      Tab title

    • [index] String optional

      ???

    • [identifier] String optional

      identifying key, should be dom safe

    • [template] String | Function optional

      template to render into tab

    • [args] Object optional

      dont use this

    • [locked] Boolean optional

      Prevents user from closing tab

    • [icon] String optional

      Icon for title

  • $container Object

    dont use this

Returns:

Undefined:

destroy

() awa.mvc.View

clears out all widgets, grids, and events. Also removes and destroys children

Returns:

awa.mvc.View:

this

doChildrenLayouts

() Undefined

Needed for height fixing and other positioning changes

Returns:

Undefined:

doLayout

() Undefined

Needed for height fixing and other positioning changes

Returns:

Undefined:

getWidget

() Array

get the view controlling a widget by it's selector

Returns:

Array:

widgets

insertTab

(
  • params
)
Undefined

wrapper for old views that use the old methods

Parameters:

  • params Object

    This can be either the constructor method or an already constructed view. I'd suggest you construct your view first as it's easier to track any issues.

Returns:

Undefined:

on

(
  • event
  • callback
  • context
)
Undefined

More Magic

Parameters:

  • event String

    Event string

  • callback Function

    Callback

  • context Object

    Context

Returns:

Undefined:

onDestroyed

(
  • callback
  • context
)
Undefined

More Magic

Parameters:

  • callback Function

    Callback

  • context Object

    Context

Returns:

Undefined:

onNewTabID

(
  • args
)
Undefined

sets current tab with args object. tabIdentifier is required to find the correct tab. The entire args object is passed through to the view in the tab.

Parameters:

  • args Object

    Options object

    • tabIdentifier String

      web safe string identifier for tab

    • id String

      web safe string identifier for tab. either this or tabIdentifier is requires

Returns:

Undefined:

onRendered

(
  • callback
  • context
)
Undefined

This is called only once in the lifetime of a view, if you bind to it before the view is rendered, the function will be called after triggerRendered is called.

Parameters:

  • callback Function

    Callback

  • context Object

    Defines scope of callback

Returns:

Undefined:

onSelectedTabClosed

(
  • tab
)
Boolean

Stub function to allow child views to handle what to do when a selected tab is closed.

Returning true prevents the default action.

Parameters:

  • tab Object

    Tab config

Returns:

Boolean:

true if default action should be prevented

onTabCreated

(
  • callback
  • [context]
)
Undefined

The onTabCreated method binds to the tabcreated event. when calling this method, all existing tabs that have been created are passed to the function. This prevents you from having to check what tabs already exist. There is a onceTabCreated and an offTabCreated.

Parameters:

  • callback Function

    Event handler

  • [context] Object optional

    object to represent this

Returns:

Undefined:

onTabDestroyed

(
  • callback
  • [context]
)
Undefined

Parameters:

  • callback Function

    Event handler

  • [context] Object optional

    object to represent this

Returns:

Undefined:

onTabDisplayed

(
  • callback
  • [context]
)
Undefined

Parameters:

  • callback Function

    Event handler

  • [context] Object optional

    object to represent this

Returns:

Undefined:

refresh

() awa.mvc.View

There is a habit of re-rendering entire views when it may not be necessary. Parent views can check the rendered flag and call refresh instead if the child view has already been rendered.

Returns:

awa.mvc.View:

this

render

() awa.mvc.TabContainerView chainable

overrides backbone.view's render method. Sets the rendered property to rendered and renders any provided templates. This also binds any buttons in the view to it's action IF it has an actions attribute. The action attribute value should match the name of the function in the view class.

Returns:

requestChange

(
  • callback
)
Undefined

Parent views should check this before changing/swapping a view. Useful for views that are in edit mode that you want to do confirmation before leaving.

Parameters:

  • callback Function

    function to call when you have determined if the view can close or not. If it can close, return an object with property 'success' set to 1.

Returns:

Undefined:

requestClose

(
  • callback
)
Undefined

Parent views should check this before closing a view. Useful for views that are in edit mode that you want to do confirmation before closing.

Parameters:

  • callback Function

    function to call when you have determined if the view can close or not. If it can close, return an object with property 'success' set to 1.

Returns:

Undefined:

setCurrentTab

(
  • [args]
)
Object

use an args object to set the current tab. args are based down to the structured view's setSection method. If args.tabIdentifier is not set and args.id is, the routeRoot is used in conjuction with the id to generate a tabIdentifier

Parameters:

  • [args] Object optional

    Tab configuration to match

    • [id] Object optional

      primary model id.

    • [tabIdentifier] Object optional

      tab identifier

Returns:

Object:

tab object

setCurrentTabAsContentList

() Undefined

quick function to set the model list view tab as the current tab

Returns:

Undefined:

setElement

(
  • element
  • [delegate]
)
Undefined

Overidden setElement method applies the className to the new element the view is applied to. Also, if multiple views are passed in (what is returned from a jquery selector) it will be the top of the list.

Parameters:

  • element Jquery.Selector

    Jquery selector

  • [delegate] ? optional

    ?

Returns:

Undefined:

triggerRendered

(
  • args
)
Undefined

The view should only call this once its completely rendered. This does not include refreshing views (i.e. grids changing pages). This also sets the view's rendered property to true.

Parameters:

  • args Object

    parameter to emit

Returns:

Undefined:

viewOptions

() Array

the constructor uses this function to determine which properties to pull out of the passed in options to directly attach to the view. All other options can be referenced from the view's options property

Returns:

Array:

Acceptable view options

Properties

__parent__

View

Parent view object

Default: undefined

className

Boolean | Function

when this view is rendered, it will create a new element with this class added. If the setElement method is used, this will append itself to the class attribute

Default: "awa-mvc-View"

closeOnReplace

Boolean

Mostly for views that contain multiple views. This allows a parent view to know that the view should be closed and destroyed when another view is swapped in.

Default: false

globalKeys

Object

used for the keymaster plugin. These will be scoped to the entire app.

Default: undefined

keys

Object

used for the keymaster plugin. These will be scoped to this view in the future.

Default: undefined

ModelListStructuredViewClass

Class

View class for model structured view that handles list responsibilites

Default: undefined

modelListViewArgs

Function | Object

args object that is passed to list structured view class

Default: undefined

ModelListViewClass

Class

View class for model contents list view

Default: undefined

ModelStructuredViewClass

Class

View class for model structured view

Default: undefined

modelViewArgs

Obejct

Default properties based to the constructor of each Structured View

Default: {}

refreshOnReplace

Boolean

Mostly for views that contain multiple views. This allows a parent view to know that the view should be refreshed when this view is swapped back in.

Default: true

rendered

Boolean

Lets you know if this view object has been rendered or not. If you override the render method without doing a supercall, be sure to set it to true when you are done rendering.

Default: false

routeRoot

String

override this in a subclass to specify the route root used by awa.hist.setLocation. This is also used in tab identifiers

Default: undefined

title

Strin

Can be used by parent views to put on tabs, control bars, popup headers, etc. Use accessor methods.

Default: "View"

tpl

Function

default template to use with this view, the render method will use this and inject the resulting html into it's $el.

Default: undefined

tplArgs

Object

arguments that are passed to the template

Default: undefined