awa.mvc.TabContainerView Class
/var/www/azaleahealth.com/branches/docs/source_repo/awa/resources/apps/js/awa/mvc/TabContainerView.js:2
The TabContainerView is the overall view you see in a tab. It should contain a header, context section/menu, control bar, sidebar, and contents view. You do have the freedom to not use this view but doing so will allow easier refactoring and a structured way to handle different platforms (varying screen size, mobile, touchscreens, etc.) Provided below is some boilerplate code for creating a new StructuredView.
events tabCreated, tabDisplayed, tabDestroyed
Constructor
awa.mvc.TabContainerView
-
[options.menu] -
[options.tabs] -
[options.headerTpl] -
[options.headerTplArgs] -
[options.contextTpl] -
[options.contextTplArgs] -
[options.controlsTpl] -
[options.controlsTplArgs] -
[options.sidebarTpl] -
[options.sidebarTplArgs] -
[options.contentsTpl] -
[options.contentsTplArgs]
Parameters:
-
[options.menu]awa.mvc.Model | main.MenuModel optionalMenu model. Used with Main Menu Views
-
[options.tabs]Array optionalPreset tab configurations. see insertTab
-
[options.headerTpl]Function optionalunderscore template function to be used in the render if you call this class' render function
-
[options.headerTplArgs]Object optionalargs passed to the template. If none are provided, the view will take the model, convert it to a regular object and pass that to the template.
-
[options.contextTpl]Function optionalunderscore template function to be used in the render if you call this class' render function
-
[options.contextTplArgs]Object optionalargs passed to the template. If none are provided, the view will take the model, convert it to a regular object and pass that to the template.
-
[options.controlsTpl]Function optionalunderscore template function to be used in the render if you call this class' render function
-
[options.controlsTplArgs]Object optionalargs passed to the template. If none are provided, the view will take the model, convert it to a regular object and pass that to the template.
-
[options.sidebarTpl]Function optionalunderscore template function to be used in the render if you call this class' render function
-
[options.sidebarTplArgs]Object optionalargs passed to the template. If none are provided, the view will take the model, convert it to a regular object and pass that to the template.
-
[options.contentsTpl]Function optionalunderscore template function to be used in the render if you call this class' render function
-
[options.contentsTplArgs]Object optionalargs passed to the template. If none are provided, the view will take the model, convert it to a regular object and pass that to the template.
Item Index
Methods
- allowedEvents
- bindToModel
- createTab
- destroy
- doChildrenLayouts
- doLayout
- getTabView
- getWidget
- insertTab
- on
- onDestroyed
- onNewTabID
- onNewTabID
- onRendered
- onSelectedTabClosed
- onTabCreated
- onTabDestroyed
- onTabDisplayed
- refresh
- render
- requestChange
- requestClose
- setElement
- triggerDestroyed
- triggerRendered
- viewOptions
Methods
allowedEvents
()
Undefined
This is a function, but what's important is the returned value. 'tabCreated', 'tabDisplayed', 'tabDestroyed', 'destroyed', 'rendered'
Returns:
bindToModel
-
[model]
Parameters:
-
[model]awa.mvc.Model | Backbone.Model optionalModel to bind to
Returns:
createTab
-
params -
$container
Adds a new tab and view area to the tabbed container view
Parameters:
-
paramsObjectThis 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.
-
onTabSelectString | FunctionThis 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 optionalView instance that is displayed in tab panel
-
[viewArgs]Array optionalArguments applied to the view class
-
[title]String optionalTab title
-
[index]String optional???
-
[identifier]String optionalidentifying key, should be dom safe
-
[template]String | Function optionaltemplate to render into tab
-
[args]Object optionaldont use this
-
[locked]Boolean optionalPrevents user from closing tab
-
[icon]String optionalIcon for title
-
-
$containerObjectdont use this
Returns:
destroy
()
awa.mvc.View
Returns:
doChildrenLayouts
()
Undefined
Returns:
doLayout
()
Undefined
Returns:
getTabView
-
id
Parameters:
-
idStringTab identifier
Returns:
View in tab
getWidget
()
Array
Returns:
insertTab
-
params
wrapper for old views that use the old methods
Parameters:
-
paramsObjectThis 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:
on
-
event -
callback -
context
More Magic
Parameters:
-
eventStringEvent string
-
callbackFunctionCallback
-
contextObjectContext
Returns:
onDestroyed
-
callback -
context
More Magic
Parameters:
-
callbackFunctionCallback
-
contextObjectContext
Returns:
onNewTabID
-
[args]
if the setCurrentTab receives a set of args that does not match with a current tab, this method is called. Override the method the react by creating a new tab, throwing and error, redirecting, etc.
Parameters:
-
[args]Object optionalArgument options
Returns:
onNewTabID
-
args
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:
-
argsObjectOptions object
-
tabIdentifierStringweb safe string identifier for tab
-
idStringweb safe string identifier for tab. either this or tabIdentifier is requires
-
Returns:
onRendered
-
callback -
context
Parameters:
-
callbackFunctionCallback -
contextObjectDefines scope of callback
Returns:
onSelectedTabClosed
-
tab
Stub function to allow child views to handle what to do when a selected tab is closed.
Returning true prevents the default action.
Parameters:
-
tabObjectTab config
Returns:
true if default action should be prevented
onTabCreated
-
callback -
[context]
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:
-
callbackFunctionEvent handler
-
[context]Object optionalobject to represent this
Returns:
onTabDestroyed
-
callback -
[context]
Parameters:
-
callbackFunctionEvent handler
-
[context]Object optionalobject to represent this
Returns:
onTabDisplayed
-
callback -
[context]
Parameters:
-
callbackFunctionEvent handler
-
[context]Object optionalobject to represent this
Returns:
refresh
()
awa.mvc.View
Returns:
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:
this
requestChange
-
callback
Parameters:
-
callbackFunctionfunction 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:
requestClose
-
callback
Parameters:
-
callbackFunctionfunction 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:
setElement
-
element -
[delegate]
Parameters:
-
elementJquery.SelectorJquery selector -
[delegate]? optional?
Returns:
triggerDestroyed
()
Undefined
More Magic
Returns:
triggerRendered
-
args
Parameters:
-
argsObjectparameter to emit
Returns:
viewOptions
()
Array
Returns:
Properties
__parent__
View
Default: undefined
className
Boolean | Function
Default: "awa-mvc-View"
closeOnReplace
Boolean
Default: false
globalKeys
Object
Default: undefined
keys
Object
Default: undefined
refreshOnReplace
Boolean
Default: true
rendered
Boolean
Default: false
title
Strin
Default: "View"
tpl
Function
Default: undefined
tplArgs
Object
Default: undefined