Members
__children__ :Object
Automatically (and not, if you wish) creates and renders nested views. Actually is a hash. Each field can take 4 forms:
'.js-someSelector': MyViewClass
'.js-anotherSelector': [MyViewClass, {answer: 42}]
// second element will be passed to MyViewClass constructor'.js-yetAnotherSelector': [MyViewClass, 'someMethodName']
// this['someMethodName'] will be called in proper context (this
), and result will be passed to MyViewClass constructor'.js-selectorToo': [MyViewClass, function () { return {answer: 42} }]
// second element will be called in proper context, and result will be passed to MyViewClass constructor
All mentioned views will be placed to this.children
hash for further managing during Skull.View#onRender
.
Type:
- Object
__ui__
Automatically (and not, if you wish) creates links to nodes inside your view. This is useful (and handy),
when you change some node's attributes several times during view's lifecycle.
Actually is a config in following form:
somePrettyName: '.some .selector'
All defined bits will be placed to this.ui
hash for further managing during Skull.View#onRender
.
_parentResult :function
Type:
- function
replaceEl
Whether this.$el
will be completely replaced on rendering
Methods
onBeforeRemove()
Cleans up: removes nested views, shuts down events both DOM and Backbone's
onRender()
Performs declarative bindings: __children__
, __ui__
, events.
Call this method when html is ready.
registerChild(viewNameopt, viewClass, options) → {View}
Registers nested view
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
viewName |
String |
<optional> |
defaults to |
viewClass |
View | ||
options |
Object |
Returns:
- Type
- View
remove()
Acts as destructor
render() → {*}
Default rendering procedure: renders this.collection
or this.model
or {}
.
Feel free to override if needed.
Returns:
data passed to template
- Type
- *
rr(tplDataopt, replaceopt)
Shortcut for rendering this.tpl to this.$el
(or instead of this element)
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
tplData |
Skull.Model | Skull.Collection | Object |
<optional> |
{} | if this parameter have |
replace |
Boolean |
<optional> |
false | whether replace whole |
unregisterChild(viewName)
Carefully removes nested view
Parameters:
Name | Type | Description |
---|---|---|
viewName |
String |