Classes
- Behavior
- Cell ⇐
Backbone-Model
- Collection ⇐
Backbone-Collection
- Events ⇐
Backbone-Events
- FormModel ⇐
NestedModel
- FormView ⇐
View
- ListView ⇐
View
- ListView
- Model ⇐
Backbone-Model
- NestedCell ⇐
NestedModel
- NestedModel ⇐
Backbone-NestedModel
- Router ⇐
Backbone-Router
- ServiceCell ⇐
Cell
- ViewStateCell ⇐
NestedCell
- ViewStateCell
- View ⇐
Backbone-View
View
- history ⇐
Backbone-History
- registry ⇐
Backbone-Events
- DataBehavior ⇐
Behavior
- PrivateCollection ⇐
Collection
Mixins
- validationMixin
Contains the methods that are mixed in on the model when binding
- cacheMixin
Custom additions to the Backbone Collection object.
- safe disposal methods for memory + event management
- special functional overrides to support ID registration for different views
- cellMixin
An non-persistable object that can listen to and emit events like a models.
- loadingMixin
Loading logic.
- modelMixin
The base for a model
- pollingMixin
Periodic Polling Object to be mixed into Backbone Collections and Models.
The polling functionality should only be used for collections and for models that are not
part of any collections. It should not be used for a model that is a part of a collection.
Objects
- HandlebarsHelper :
object
- templateRenderer :
object
Static Template Engine.
All template renders should be piped through this method.- torso :
object
Module containing all dependencies that exports a single object with everything attached (same format as the global).
- Validation :
object
Validation object containing validation mixin.
Functions
- handlebarsUtils(Handlebars)
Extensions to handlebars helpers.
Adds additonal helpers to [Handlebars](#external_Handlebars)
- stickitUtils()
Extensions to stickit handlers.
External
- Backbone-Collection ⇐
Backbone-Events
The backbone Collection reference
- Backbone-Events
The backbone Events reference
- Backbone-Model ⇐
Backbone-Events
The backbone Model reference
- Backbone-NestedModel ⇐
Backbone-Model
The Backbone-Nested reference
- Backbone-Router ⇐
Backbone-Events
The backbone Router reference
- Backbone-View ⇐
Backbone-Events
The backbone View reference
- Handlebars
The handlebars reference
- Handlebars-Template
The handlebars Template reference
- Backbone-History ⇐
Backbone-Events
The backbone History reference
- jQuery
The jQuery reference
- jQuery-Deferred
The jQuery Deferred reference
- Backbone
The backbone View reference
Behavior
Kind: global class
See: Behavior Annotated Source
Author: deena.wang@vecna.com
- Behavior
- new Behavior(behaviorAttributes, behaviorOptions, [viewOptions])
- .alias :
string
- .cidPrefix :
string
- .mixin :
Object
- .prepare() ⇒
Object
- ._dispose()
- .isDisposed() ⇒
boolean
new Behavior(behaviorAttributes, behaviorOptions, [viewOptions])
Allows abstraction of common view logic into separate object
Param | Type | Description |
---|---|---|
behaviorAttributes | Object |
<p>the initial value of the behavior’s attributes.</p> |
behaviorOptions | Object |
|
behaviorOptions.view | Backbone-View |
<p>that Behavior is attached to</p> |
behaviorOptions.alias | string |
<p>the alias for the behavior in this view.</p> |
[viewOptions] | Object |
<p>options passed to View’s initialize</p> |
behavior.alias : string
Unique name of the behavior instance w/in a view. More human readable than the cid.
Kind: instance property of Behavior
behavior.cidPrefix : string
cidPrefix of Behaviors
Kind: instance property of Behavior
behavior.mixin : Object
Add functions to be added to the view's public API. They will be behavior-scoped.
Kind: instance property of Behavior
behavior.prepare() ⇒ Object
The behavior's prepare result will be combined with the view's prepare with the behavior's alias as the namespace.
effectively: { [behaviorName]: behavior.prepare() } will be combined with the view's prepare result.
Kind: instance method of Behavior
Returns: Object
- <p>a prepare context suitable to being added to the view’s prepare result.</p>
behavior._dispose()
Method to be invoked when dispose is called. By default calling dispose will remove the
behavior's on's and listenTo's.
Override this method to destruct any extra
Kind: instance method of Behavior
behavior.isDisposed() ⇒ boolean
Kind: instance method of Behavior
Returns: boolean
- <p>true if the view was disposed</p>
Cell ⇐ Backbone-Model
Kind: global class
Extends: Backbone-Model
Mixes: cellMixin
See: Cell Annotated Source
Author: ariel.wexler@vecna.com, kent.willis@vecna.com
new Cell(attributes, [options])
An non-persistable object that can listen to and emit events like a models.
Param | Type | Default | Description |
---|---|---|---|
attributes | Object |
<p>the initial attributes to use for this cell.</p> | |
[options] | Object |
{} |
<p>the options for setting up this cell.</p> |
[options.register] | boolean |
false |
<p>whether to register this cell in the app-level registry. By default this will NOT add it to the registry unless set to true because we have not mechanism that will make sure the cells get removed from the registry at the appropriate times.</p> |
cell.isModelCompatible
Whether a cell can pass as a model or not.
If true, the cell will not fail is persisted functions are invoked
If false, the cell will throw exceptions if persisted function are invoked
Kind: instance property of Cell
Mixes: isModelCompatible
Default: false
Properties
Name | Type |
---|---|
isModelCompatible | boolean |
cell.save()
Override and disable the save function
Kind: instance method of Cell
Mixes: save
cell.fetch()
Override and disable the fetch function
Kind: instance method of Cell
Mixes: fetch
cell.sync()
Override and disable the sync function
Kind: instance method of Cell
Mixes: sync
cell.url()
Override and disable the url
Kind: instance method of Cell
Mixes: url
Collection ⇐ Backbone-Collection
Kind: global class
Extends: Backbone-Collection
Mixes: pollingMixin
, loadingMixin
, cacheMixin
See: Collection Annotated Source
Author: kent.willis@vecna.com
- Collection ⇐
Backbone-Collection
- new Collection()
- .pollTimeoutId
- .filterDefault() ⇒
Collection
- .dispose()
- .isPolling()
- .startPolling(pollInterval)
- .stopPolling()
- .polledFetch()
- .constructor([options])
- .hasLoadedOnce() ⇒
boolean
- .isLoading() ⇒
boolean
- .getLoadedOncePromise() ⇒
Promise
- .fetch(options)
- .getRequesterIds(the) ⇒
Array
- .getRequesterIdsAsDictionary(guid) ⇒
Object
- .removeRequester(guid)
- .getRequesters() ⇒
Array
- .getAllRequestedIds() ⇒
Array
- .createPrivateCollection(guid) ⇒
PrivateCollection
- .registerIds(newIds, guid)
- .fetchByIds([fetchByIdsOptions]) ⇒
Promise
new Collection()
Generic Collection
collection.pollTimeoutId
Kind: instance property of Collection
Mixes: pollTimeoutId
Properties
Name | Type | Description |
---|---|---|
pollTimeoutId | number |
<p>The id from when setTimeout was called to start polling.</p> |
collection.filterDefault() ⇒ Collection
The default filter. Always returns itself.
Kind: instance method of Collection
Returns: Collection
- <p>a new instance of this collection</p>
collection.dispose()
Will abolish all listeners and events that are hooked
to this collection.
Kind: instance method of Collection
collection.isPolling()
Returns true if the poll is active
Kind: instance method of Collection
Mixes: isPolling
collection.startPolling(pollInterval)
Starts polling Model/Collection by calling fetch every pollInterval.
Note: Each Model/Collection will only allow a singleton of polling to occur so
as not to have duplicate threads updating Model/Collection.
Kind: instance method of Collection
Mixes: startPolling
Param | Type | Description |
---|---|---|
pollInterval | Integer |
<p>interval between each poll in ms.</p> |
collection.stopPolling()
Stops polling Model and clears all Timeouts.
Kind: instance method of Collection
Mixes: stopPolling
collection.polledFetch()
By default, the polled fetching operation is routed directly
to backbone's fetch all.
Kind: instance method of Collection
Mixes: polledFetch
collection.constructor([options])
The constructor constructor / initialize method for collections.
Allocate new memory for the local references if they
were null when this method was called.
Kind: instance method of Collection
Mixes: constructor
Param | Type | Default | Description |
---|---|---|---|
[options] | Object |
<p>optional options object</p> | |
[options.fetchHttpAction] | string |
"'POST'" |
<p>http action used to get objects by ids</p> |
[options.getByIdsUrl] | string |
"'/ids'" |
<p>path appended to collection.url to get objects by a list of ids</p> |
[options.fetchUsingTrackedIds] | boolean |
true |
<p>if set to false, cache.fetch() will not pass to fetchByIds with current tracked ids but will rather call the default fetch method.</p> |
collection.hasLoadedOnce() ⇒ boolean
Kind: instance method of Collection
Mixes: hasLoadedOnce
Returns: boolean
- <p>true if this model/collection has ever loaded from a fetch call</p>
collection.isLoading() ⇒ boolean
Kind: instance method of Collection
Mixes: isLoading
Returns: boolean
- <p>true if this model/collection is currently loading new values from the server</p>
collection.getLoadedOncePromise() ⇒ Promise
Kind: instance method of Collection
Mixes: getLoadedOncePromise
Returns: Promise
- <p>a promise that will resolve when the model/collection has loaded for the first time</p>
collection.fetch(options)
Overrides the base fetch call if this.fetchUsingTrackedIds is true
Calling fetch from the cache will fetch the tracked ids if fetchUsingTrackedIds is set to true, otherwise
it will pass through to the default fetch.
Kind: instance method of Collection
Mixes: fetch
Param | Type |
---|---|
options | Object |
collection.getRequesterIds(the) ⇒ Array
Kind: instance method of Collection
Mixes: getRequesterIds
Returns: Array
- <p>an array of the ids the requester with the guid has requested</p>
Param | Type | Description |
---|---|---|
the | string |
<p>global unique id of the requester</p> |
collection.getRequesterIdsAsDictionary(guid) ⇒ Object
This method is used for quick look up of a certain id within the list of requested ids
Kind: instance method of Collection
Mixes: getRequesterIdsAsDictionary
Returns: Object
- <p>an dictionary of id -> id of the requester ids for a given requester.</p>
Param | Type | Description |
---|---|---|
guid | string |
<p>the global unique id of the requester</p> |
collection.removeRequester(guid)
Removes a requester from this cache. No longer receives updates
Kind: instance method of Collection
Mixes: removeRequester
Param | Type | Description |
---|---|---|
guid | string |
<p>the global unique id of the requester</p> |
collection.getRequesters() ⇒ Array
NOTE: this methods returns only the guids for requester collections that are currently tracking ids
TODO: should this return just the knownPrivateCollections
Kind: instance method of Collection
Mixes: getRequesters
Returns: Array
- <p>an array of the all requesters in the form of their GUID’s</p>
collection.getAllRequestedIds() ⇒ Array
Return the list of Ids requested by this collection
Kind: instance method of Collection
Mixes: getAllRequestedIds
Returns: Array
- <p>the corresponding requested Ids</p>
collection.createPrivateCollection(guid) ⇒ PrivateCollection
Used to return a collection of desired models given the requester object.
Binds a custom "resized" event to the private collections.
Overrides the fetch method to call the parent collection's fetchByIds method.
Overrides the registerIds method to redirect to its parent collection.
Kind: instance method of Collection
Mixes: createPrivateCollection
Returns: PrivateCollection
- <p>an new empty collection of the same type as "this"</p>
Param | Type | Description |
---|---|---|
guid | string |
<p>Identifier for the requesting view</p> |
collection.registerIds(newIds, guid)
Registers a list of Ids that a particular object cares about and pushes
any cached models its way.
This method intelligently updates the "_requestedIds" field to contain all unique
requests for Ids to be fetched. Furthermore, the "polledFetch" method
is overriden such that it no longer routes through Backbone's fetch all,
but rather a custom "fetchByIds" method.
Kind: instance method of Collection
Mixes: registerIds
Param | Type | Description |
---|---|---|
newIds | Array |
<p>New ids to register under the requester</p> |
guid | string |
<p>The GUID of the object that wants the ids</p> |
collection.fetchByIds([fetchByIdsOptions]) ⇒ Promise
A custom fetch operation to only fetch the requested Ids.
Kind: instance method of Collection
Mixes: fetchByIds
Returns: Promise
- <p>the promise of the fetch</p>
Param | Type | Default | Description |
---|---|---|---|
[fetchByIdsOptions] | <p>argument fetchByIdsOptions</p> | ||
[fetchByIdsOptions.idsToFetch] | Array |
collection.collectionTrackedIds |
<p>A list of request Ids, will default to current tracked ids</p> |
[fetchByIdsOptions.setOptions] | Object |
<p>if a set is made, then the setOptions will be passed into the set method</p> |
Events ⇐ Backbone-Events
Kind: global class
Extends: Backbone-Events
See: Events Annotated Source
Author: ariel.wexler@vecna.com, kent.willis@vecna.com
new Events()
Generic Events.
FormModel ⇐ NestedModel
Kind: global class
Extends: NestedModel
Mixes: validationMixin
See: FormModel Annotated Source
Author: kent.willis@vecna.com
- FormModel ⇐
NestedModel
- new FormModel()
- .mapping :
Object
- .models :
Object
- .pollTimeoutId
- .constructor([options])
- .getMapping(alias) ⇒
- .getMappings() ⇒
- .setMapping(alias, mapping, [models], [copy])
- .setMappings(mappings, [models], [copy])
- .unsetMapping(aliasOrModel, [removeModelIfUntracked])
- .unsetMappings()
- .getTrackedModel(alias) ⇒
Backbone-Model
- .getTrackedModels() ⇒
.setTrackedModel()- .trackModel(alias, model, [copy])
.setTrackedModels()- .trackModels(models, [copy])
.unsetTrackedModel()- .untrackModel(aliasOrModel)
.unsetTrackedModels()- .untrackModels()
- .push()
- .pull()
- .save([options]) ⇒
- .isTrackingAnyObjectModel() ⇒
- .isUpdating() ⇒
- .startUpdating([pullFirst])
- .stopUpdating()
- .resetUpdating()
- .isModelStale(model, [staleModels], [currentHashValues]) ⇒
boolean
- .checkIfModelsAreStale() ⇒
Array
- .preValidate(attr, [value]) ⇒
undefined
|string
|Object
- .isValid()
- .validate()
- .isPolling()
- .startPolling(pollInterval)
- .stopPolling()
- .polledFetch()
- .dispose()
- ._dispose()
new FormModel()
Generic Form Model
formModel.mapping : Object
Map from aliases (either model names or computed value names) to mappings.
Please refer to the documentation on the constructor about the form and options for this field.
Kind: instance property of FormModel
Properties
Name |
---|
mapping |
formModel.models : Object
Map from model aliases to model instances.
Please refer to the documentation on the constructor about the form and options for this field.
Kind: instance property of FormModel
Properties
Name |
---|
models |
formModel.pollTimeoutId
Kind: instance property of FormModel
Mixes: pollTimeoutId
Properties
Name | Type | Description |
---|---|---|
pollTimeoutId | number |
<p>The id from when setTimeout was called to start polling.</p> |
formModel.constructor([options])
Constructor the form model. Can take in attributes to set initially. These will override any pulled values from object models
on initialization. On initialization the object model's values will be pulled once.
For the options, here are needed definitions:
mapping: {
modelName: 'foo bar baz' // track a model by providing an alias for a name and a space seperated list of fields to track as a String
modelName2: true // to track all fields
... // can have many model mappings
computedName: {
modelName: 'taz raz', // mappings for models that will be used for this computed mapping.
... // can have many model mappings for a computed
pull: function(models) {}, // a callback that will be invoked when pulling data from the Object model. Passes in a map of model alias/name to shallow copies of fields being tracked on that model.
push: function(models) {} // a callback that will be invoked when pushing data to the Object model. Passes in a map of model alias/name to object model being tracked under that alias.
}
},
models: {
modelName: modelInstance, // optionally, provide a set of model instance to model name (aliases) to start tracking
modelName2: modelInstance2 // provide as many aliases to model instances as you'd like
}
Kind: instance method of FormModel
Param | Type | Default | Description |
---|---|---|---|
[options] | Object |
||
[options.mapping] | Object |
<p>map from aliases (either model names or computed value names) to mappings. A model mapping can bind an alias to a space seperated list of fields to track as a String r the boolean true if it is mapping all the fields. A computed mapping can bind an alias to a set of model mappings required for this computed value and both a pull and/or push method that are used to compute different values to or from object model(s).</p> |
|
[options.models] | Object |
<p>Because the options.mapping parameter only allows you to define the mappings to aliases, this options allows you to bind model instances to aliases. Setting model instances to aliases are required to actually begin pulling/pushing values.</p> |
|
[options.startUpdating] | boolean |
false |
<p>set to true if you want to immediately set up listeners to update this form model as the object model updates. You can always toggle this state with startUpdating() and stopUpdating().</p> |
[options.validation] | Object |
<p>A Backbone.Validation plugin hash to dictate the validation rules</p> | |
[options.labels] | Object |
<p>A Backbone.Validation plugin hash to dictate the attribute labels</p> |
formModel.getMapping(alias) ⇒
Kind: instance method of FormModel
Returns: <p>the mapping config for that alias</p>
Param | Type | Description |
---|---|---|
alias | string |
<p>the alias of the mapping - either a model mapping or a computed mapping</p> |
formModel.getMappings() ⇒
Kind: instance method of FormModel
Returns: <p>all the current mapping configs</p>
formModel.setMapping(alias, mapping, [models], [copy])
Define or redefine how the form model pull/pushes or otherwise tracks properties between an object model(s).
Examples:
this.setMapping('modelAlias', true, optional model instance);
this.setMapping('modelAlias, 'foo bar baz', optional model instance);
this.setMapping('computedAlias', {
model1: 'foo',
model2: 'bar',
push: function(models) {
models.model1.set('foo', this.get('foobar')[0]);
models.model2.set('bar', this.get('foobar')[1]);
},
pull: function(models) {
this.set('foobar', [models.model1.foo, models.model2.bar]);
},
}, optional model map)
Kind: instance method of FormModel
Param | Type | Default | Description |
---|---|---|---|
alias | string |
<p>the name for the mapping - either a model mapping or a computed mapping</p> | |
mapping | string | boolean | Object |
<p>Provides the mapping for this alias. If trying to map to a model, then either provide a space delimited list of fields to track as a String or the boolean true to track all the model’s fields. If the mapping is for a computed value, then provide a map from model alias to model mapping for all the fields needed for the computed and a pull method if you want to change/combine/split object model properties before bringing them into the form model and a push method if you want to change/combine/split form model properties before pushing them to the object models.</p> |
|
[models] | Object | Backbone-Model |
<p>Provides instances to use for this mapping. If mapping is a computed, provide a map from alias to model instance. If mapping is for a single model, just provide the model instance for that alias.</p> |
|
[copy] | false |
<p>if true, will pull values definined by this mapping after setting the mapping. Requires models to be passed in.</p> |
formModel.setMappings(mappings, [models], [copy])
Sets multiple mappings (both model mappings and computed value mappings) with one call.
Uses the same style of mapping syntax as the constructor. Please refer to the documentation on the constructor.
Here is an example:
this.setMappings({
model1: 'foo bar',
model2: 'baz',
ssn: {
model1: 'ssn',
model2: 'lastssn'
push: function(models) {},
pull: function(models) {},
}
}, optional model map)
Kind: instance method of FormModel
Param | Type | Default | Description |
---|---|---|---|
mappings | Object |
<p>Uses the same style of mapping syntax as the constructor. Please refer to the documentation on the constructor.</p> | |
[models] | Object |
<p>this parameter allows you to immediately bind model instances to aliases. Keys are aliases and values are external:Backbone-Models.</p> | |
[copy] | false |
<p>if true, will pull values definined by this mapping after setting the mapping. Requires models to be passed in.</p> |
formModel.unsetMapping(aliasOrModel, [removeModelIfUntracked])
Remove a mapping (model or computed) by alias
Kind: instance method of FormModel
Param | Type | Default | Description |
---|---|---|---|
aliasOrModel | string | Backbone-Model |
<p>if a String is provided, it will unset the mapping with that alias. If a external:Backbone-Model is provided, it will remove the model mapping that was bound to that model.</p> |
|
[removeModelIfUntracked] | boolean |
false |
<p>If true, after the mapping is removed, the model will also be unset but only if no other mappings reference it. Note, setting this to true will not remove any computed mappings that also use that model.</p> |
formModel.unsetMappings()
Removes all current mappings
Does NOT remove current model being tracked. Call this.untrackModels afterwards if you wish this behavior.
Kind: instance method of FormModel
formModel.getTrackedModel(alias) ⇒ Backbone-Model
Returns the object model currently bound to the given name/alias.
Kind: instance method of FormModel
Returns: Backbone-Model
- <p>the model currently bound to the alias</p>
Param | Type | Description |
---|---|---|
alias | string |
<p>the name/alias used by the mappings.</p> |
formModel.getTrackedModels() ⇒
Returns all the currently tracked object models
Kind: instance method of FormModel
Returns: <p>all the currently tracked object models</p>
formModel.setTrackedModel()
Deprecated
Use [trackModel](#FormModel+trackModel) instead.
Kind: instance method of FormModel
See: trackModel
formModel.trackModel(alias, model, [copy])
Update or create a binding between an object model and an alias.
Kind: instance method of FormModel
Param | Type | Default | Description |
---|---|---|---|
alias | string |
<p>the alias/name to bind to.</p> | |
model | Backbone-Model |
<p>the model to be bound. Mappings referencing this alias will start applying to this model.</p> | |
[copy] | boolean |
false |
<p>if true, the form model will perform a pull on any mappings using this alias.</p> |
formModel.setTrackedModels()
Deprecated
Use [trackModels](#FormModel+trackModels) instead.
Kind: instance method of FormModel
See: trackModels
formModel.trackModels(models, [copy])
Binds multiple models to their aliases.
Kind: instance method of FormModel
Param | Type | Default | Description |
---|---|---|---|
models | Object.<string, external:Backbone-Model> |
<p>A map from alias/name to model to be bound to that alias.</p> | |
[copy] | boolean |
false |
<p>if true, the form model will perform a pull on any mapping using these models.</p> |
formModel.unsetTrackedModel()
Deprecated
Use [untrackModel](#FormModel+untrackModel) instead.
Kind: instance method of FormModel
See: untrackModel
formModel.untrackModel(aliasOrModel)
Removes the binding between a model alias and a model instance. Effectively stops tracking that model.
Kind: instance method of FormModel
Param | Type | Description |
---|---|---|
aliasOrModel | string | Backbone-Model |
<p>If a string is given, it will unset the model using that alias. If a model instance is given, it will unbind whatever alias is currently bound to it.</p> |
formModel.unsetTrackedModels()
Deprecated
Use [untrackModels](#FormModel+untrackModels) instead.
Kind: instance method of FormModel
See: untrackModels
formModel.untrackModels()
Removes all the bindings between model aliases and model instances. Effectively stops tracking the current models.
Kind: instance method of FormModel
formModel.push()
Pushes values from this form model back to the object models it is tracking. This includes invoking the push callbacks from
computed values
Kind: instance method of FormModel
formModel.pull()
Pulls the most recent values of every object model that this form model tracks including computed values
NOTE: using this method can override user-submitted data from an HTML form. Use caution.
Kind: instance method of FormModel
formModel.save([options]) ⇒
If FormModel has a "url" property defined, it will invoke a save on the form model, and after successfully
saving, will perform a push.
If no "url" property is defined then the following behavior is used:
Pushes the form model values to the object models it is tracking and invokes save on each one. Returns a promise.
NOTE: if no url is specified and no models are being tracked, it will instead trigger a 'save-fail' event and reject the returned promise
with a payload that mimics a server response: {none: { success: false, response: [{ responseJSON: { generalReasons: [{messageKey: 'no.models.were.bound.to.form'}] }}] }}
Kind: instance method of FormModel
Returns: <p>when using a "url", a promise is returned for the save on this form model.
If not using a "url", a promise that will either resolve when all the models have successfully saved in which case the context returned
is an array of the responses (order determined by first the array of models and then the array of models used by
the computed values, normalized), or if any of the saves fail, the promise will be rejected with an array of responses.
Note: the size of the failure array will always be one - the first model that failed. This is a side-effect of $.when</p>
Param | Type | Default | Description |
---|---|---|---|
[options] | Object |
||
[options.rollback] | boolean |
true |
<p>if true, when any object model fails to save, it will revert the object model attributes to the state they were before calling save. NOTE: if there are updates that happen to object models within the timing of this save method, the updates could be lost.</p> |
[options.force] | boolean |
true |
<p>if false, the form model will check to see if an update has been made to any object models it is tracking since it’s last pull. If any stale data is found, save with throw an exception with attributes: {name: ‘Stale data’, staleModels: [Array of model cid’s]}</p> |
formModel.isTrackingAnyObjectModel() ⇒
Kind: instance method of FormModel
Returns: <p>true if this form model is backed by an Object model. That means that at least one object model was bound to an mapping alias.</p>
formModel.isUpdating() ⇒
Kind: instance method of FormModel
Returns: <p>true if any updates to an object model will immediately copy new values into this form model.</p>
formModel.startUpdating([pullFirst])
Will add listeners that will automatically pull new updates from this form's object models.
Kind: instance method of FormModel
Param | Type | Default | Description |
---|---|---|---|
[pullFirst] | boolean |
false |
<p>if true, the form model will pull most recent values then start listening</p> |
formModel.stopUpdating()
This will stop the form model from listening to its object models.
Kind: instance method of FormModel
formModel.resetUpdating()
If updating, it will reset the updating events to match the current mappings.
Kind: instance method of FormModel
formModel.isModelStale(model, [staleModels], [currentHashValues]) ⇒ boolean
Kind: instance method of FormModel
Returns: boolean
- <p>true if the model passed in has been changed since the last pull from the object model.</p>
Param | Type | Description |
---|---|---|
model | Backbone.Model |
<p>the backbone model that is being checked</p> |
[staleModels] | Object |
<p>a hash that will be updated to contain this model if it is stale in the form: cid -> model.</p> |
[currentHashValues] | Object |
<p>If passed an object, it will look in this cache for the current value of the object model instead of calculating it. It should be key’ed by the model’s cid</p> |
formModel.checkIfModelsAreStale() ⇒ Array
Kind: instance method of FormModel
Returns: Array
- <p>an array of the object models that have been updated since the last pull from this form model</p>
formModel.preValidate(attr, [value]) ⇒ undefined
| string
| Object
Check whether an attribute or a set of attributes are valid. It will default to use the model's current values but
you can pass in different values to use in the validation process instead.
Kind: instance method of FormModel
Mixes: preValidate
Returns: undefined
| string
| Object
- <p>undefined if no errors, a validation exception if a single attribute, or an object with attribute name as key
and the error as the value</p>
Param | Type | Description |
---|---|---|
attr | string | Object | Array.<string> |
<p>Either the name of the attribute, an array containing many attribute names, or on object with attribute name to values</p> |
[value] | Any |
<p>a value to use for the attribute value instead of using the model’s value.</p> |
formModel.isValid()
Check to see if an attribute, an array of attributes or the
entire model is valid. Passing true will force a validation
of the model.
Kind: instance method of FormModel
Mixes: isValid
formModel.validate()
This is called by Backbone when it needs to perform validation.
You can call it manually without any parameters to validate the
entire model.
Kind: instance method of FormModel
Mixes: validate
formModel.isPolling()
Returns true if the poll is active
Kind: instance method of FormModel
Mixes: isPolling
formModel.startPolling(pollInterval)
Starts polling Model/Collection by calling fetch every pollInterval.
Note: Each Model/Collection will only allow a singleton of polling to occur so
as not to have duplicate threads updating Model/Collection.
Kind: instance method of FormModel
Mixes: startPolling
Param | Type | Description |
---|---|---|
pollInterval | Integer |
<p>interval between each poll in ms.</p> |
formModel.stopPolling()
Stops polling Model and clears all Timeouts.
Kind: instance method of FormModel
Mixes: stopPolling
formModel.polledFetch()
By default, the polled fetching operation is routed directly
to backbone's fetch all.
Kind: instance method of FormModel
Mixes: polledFetch
formModel.dispose()
Default dispose for model-like objects (Models, Cells, and ServiceCells).
Removes listeners and calls out to _dispose() for child specific dispose logic.
Triggers 2 events - "before-dispose" and "after-dispose".
Kind: instance method of FormModel
Mixes: dispose
formModel._dispose()
Dispose hook meant to be used by prototypes that extend this one that need to provide their own dispose logic.
Kind: instance method of FormModel
Mixes: \_dispose
FormView ⇐ View
Kind: global class
Extends: View
See: FormView Annotated Source
Author: ariel.wexler@vecna.com
- FormView ⇐
View
- new FormView(args)
- .template :
Handlebars-Template
- .events :
Object
- .fields :
Object
- .bindings :
Object
- .FormModelClass :
FormModel.prototype
- .viewState :
ViewStateCell
- .prepare() ⇒
Object
- .delegateEvents()
- .resetModelListeners(model, [stopListening])
- .valid()
- .invalid()
- .deactivate()
- .get()
- .set()
- .has()
- .unset()
- .toJSON()
- .getBehavior(alias) ⇒
Torso.Behavior
- ._prepare(context) ⇒
Object
- .render() ⇒
Promise
- .prerender() ⇒
Promise
|Array.<Promise>
- .updateDOM()
- .updateClassName(newClassName)
- .postrender() ⇒
Promise
|Array.<Promise>
- .templateRender()
- .undelegateEvents()
- .attachTo([$el], [options]) ⇒
Promise
- .attachView($el, view, [options]) ⇒
Promise
- .attachTrackedViews() ⇒
Promise
|Array.<Promise>
- ._attached()
- .isAttachedToParent() ⇒
boolean
- .isAttached() ⇒
boolean
- .detach()
- .detachTrackedViews([options])
- ._detached()
- .activate()
- ._activate()
- .isActive() ⇒
boolean
- ._deactivate()
- .dispose()
- ._dispose()
- .isDisposed() ⇒
boolean
- .hasTrackedViews([options]) ⇒
boolean
- .getTrackedViews([options]) ⇒
List.<View>
- .getTrackedView(viewCID) ⇒
- .registerTrackedView(view, [options]) ⇒
View
- .unregisterTrackedView(view) ⇒
View
- .unregisterTrackedViews([options]) ⇒
View
- .transitionOut(done, options)
- .transitionIn(attach, done, options)
- .invokeFeedback(to, [evt], [indexMap])
new FormView(args)
Generic Form View
Param | Type | Default | Description |
---|---|---|---|
args | Object |
<p>options argument</p> | |
[args.model] | FormModel |
new this.FormModelClass() |
<p>a form model for binding that defaults to class-level model or instantiates a FormModelClass</p> |
[args.FormModelClass] | function |
FormModel |
<p>the class (that extends FormModel) that will be used as the FormModel. Defaults to a class-level definition or FormModel if none is provided</p> |
[args.template] | Handlebars-Template |
<p>overrides the template used by this view</p> | |
[args.events] | Object |
<p>events hash: merge + override the events hash used by this view</p> | |
[args.fields] | Object |
<p>field hash: merge + override automated two-way binding field hash used by this view</p> | |
[args.bindings] | Object |
<p>binding hash: merge + override custom epoxy binding hash used by this view</p> |
formView.template : Handlebars-Template
Handlebars template for form
Kind: instance property of FormView
formView.events : Object
Backbone events hash
Kind: instance property of FormView
formView.fields : Object
Two-way binding field customization
Kind: instance property of FormView
formView.bindings : Object
Stickit bindings hash
Kind: instance property of FormView
formView.FormModelClass : FormModel.prototype
The class to be used when instantiating the form model
Kind: instance property of FormView
formView.viewState : ViewStateCell
Cell that can be used to save state for rendering the view.
Kind: instance property of FormView
formView.prepare() ⇒ Object
Prepare the formview's default render context
Kind: instance method of FormView
Overrides: prepare
Returns: Object
- <p>{Object.errors} A hash of field names mapped to error messages
{Object.success} A boolean value of true if validation has succeeded</p>
formView.delegateEvents()
Override the delegate events and wrap our custom additions
Kind: instance method of FormView
Overrides: delegateEvents
formView.resetModelListeners(model, [stopListening])
Resets the form model with the passed in model. Stops listening to current form model
and sets up listeners on the new one.
Kind: instance method of FormView
Param | Type | Default | Description |
---|---|---|---|
model | Torso.FormModel |
<p>the new form model</p> | |
[stopListening] | boolean |
false |
<p>if true, it will stop listening to the previous form model</p> |
formView.valid()
Default method called on validation success.
Kind: instance method of FormView
formView.invalid()
Default method called on validation failure.
Kind: instance method of FormView
formView.deactivate()
Deactivate callback that removes bindings and other resources
that shouldn't exist in a dactivated state
Kind: instance method of FormView
Overrides: deactivate
formView.get()
Alias to this.viewState.get()
Kind: instance method of FormView
formView.set()
Alias to this.viewState.set()
Kind: instance method of FormView
formView.has()
Alias to this.viewState.has()
Kind: instance method of FormView
formView.unset()
Alias to this.viewState.unset()
Kind: instance method of FormView
formView.toJSON()
Alias to this.viewState.toJSON()
Kind: instance method of FormView
formView.getBehavior(alias) ⇒ Torso.Behavior
Kind: instance method of FormView
Returns: Torso.Behavior
- <p>the behavior instance if one exists with that alias</p>
Param | Type | Description |
---|---|---|
alias | string |
<p>the name/alias of the behavior</p> |
formView._prepare(context) ⇒ Object
Extension point to augment the template context with custom content.
Kind: instance method of FormView
Returns: Object
- <p>[Optional] If you return an object, it will be merged with the context</p>
Param | Description |
---|---|
context | <p>the context you can modify</p> |
formView.render() ⇒ Promise
Rebuilds the html for this view's element. Should be able to be called at any time.
Defaults to using this.templateRender. Assumes that this.template is a javascript
function that accepted a single JSON context.
The render method returns a promise that resolves when rendering is complete. Typically render
is synchronous and the rendering is complete upon completion of the method. However, when utilizing
transitions/animations, the render process can be asynchronous and the promise is useful to know when it has finished.
Kind: instance method of FormView
Returns: Promise
- <p>a promise that when resolved signifies that the rendering process is complete.</p>
formView.prerender() ⇒ Promise
| Array.<Promise>
Hook during render that is invoked before any DOM rendering is performed. you can optionally return one or more promises that when all are resolved, prerender is finished. Note: render logic will not wait until promises are resolved. Produces and sets this view's elements DOM. Used during the rendering process. Override if you have custom DOM update logic. Updates this view element's class attribute with the value provided. the new value of the class attribute Hook during render that is invoked after all DOM rendering is done and tracked views attached. you can optionally return one or more promises that when all are resolved, postrender is finished. Note: render logic will not wait until promises are resolved. Hotswap rendering system reroute method. Overrides undelegateEvents If detached, will replace the element passed in with this view's element and activate the view. promise that when resolved, the attach process is complete. Normally this method is synchronous. Transition effects can the element to attach to. This element will be replaced with this view. optional options if given, this view will invoke replaceMethod function if set to true, the injection site is not saved. Registers the view as a tracked view (defaulting as a child view), then calls view.attachTo with the element argument resolved when all transitions are complete. No payload is provided upon resolution. If no transitions, then returns a resolved promise. the element to attach to OR the name of the injection site. The element with the attribute "inject= The instantiated view object to be attached optionals options object. If using transitions, this options object will be passed on to the transitionIn and transitionOut methods as well. if set to true, the view will not be activated upon attaching. if set to true, the view will be treated as a shared view and not disposed during parent view disposing. if set to true, this method will delegate attach logic to this.__transitionNewViewIntoSite if true, and options.useTransition is true, the new view's element will be added before the previous view's element. Defaults to after. if using options.useTransition, then you can explicitly define the view that should be transitioned out. Hook to attach all your tracked views. This hook will be called after all DOM rendering is done so injection sites should be available. you can optionally return one or more promises that when all are resolved, all tracked views are attached. Useful when using this.attachView with useTransition=true. Method to be invoked when the view is fully attached to the DOM (NOT just the parent). Use this method to manipulate the view true if the view is attached to a parent NOTE: depends on a global variable "document" true if the view is attached to the DOM If attached, will detach the view from the DOM. Detach all tracked views or a subset of them based on the options parameter. Optional options. If true, detach only the shared views. These are views not owned by this parent. As compared to a child view If true, detach only child views. These are views that are owned by the parent and dispose of them if the parent is disposed. Method to be invoked when the view is detached from the DOM (NOT just the parent). Use this method to clean up state Resets listeners and events in order for the view to be reattached to the visible DOM Method to be invoked when activate is called. Use this method to turn on any true if the view is active Method to be invoked when deactivate is called. Use this method to turn off any Removes all listeners, disposes children views, stops listening to events, removes DOM. Method to be invoked when dispose is called. By default calling dispose will remove the true if the view was disposed true if this view has tracked views (limited by the options parameter) Optional options. If true, only check the shared views. These are views not owned by this parent. As compared to a child view If true, only check the child views. These are views that are owned by the parent and dispose of them if the parent is disposed. Returns all tracked views, both child views and shared views. all tracked views (filtered by options parameter) Optional options. If true, get only the shared views. These are views not owned by this parent. As compared to a child view If true, get only child views. These are views that are owned by the parent and dispose of them if the parent is disposed. the view with the given cid. Will look in both shared and child views. the cid of the view Binds the view as a tracked view - any recursive calls like activate, deactivate, or dispose will the tracked view the tracked view Optional options. If true, registers view as a shared view. These are views not owned by this parent. As compared to a child view Unbinds the tracked view - no recursive calls will be made to this shared view the tracked view the shared view Unbinds all tracked view - no recursive calls will be made to this shared view the tracked view Optional options. If true, unregister only the shared views. These are views not owned by this parent. As compared to a child view If true, unregister only child views. These are views that are owned by the parent and dispose of them if the parent is disposed. Override to provide your own transition out logic. Default logic is to just detach from the page. callback that MUST be invoked when the transition is complete. optionals options object the view that is being transitioned in. the view that is being transitioned out. Typically this view. the view that is invoking the transition. Override to provide your own transition in logic. Default logic is to just attach to the page. callback to be invoked when you want this view to be attached to the dom. callback that MUST be invoked when the transition is complete. optionals options object the view that is being transitioned in. the view that is being transitioned out. Typically this view. the view that is invoking the transition. Invokes a feedback entry's "then" method the "to" field corresponding to the feedback entry to be invoked. the event to be passed to the "then" method a map from index variable name to index value. Needed for "to" fields with array notation. A view that is backed by a collection that managers views per model in the collection. Constructor for the list view object. options argument the class definition of the item view. This view will be instantiated for every model returned by modelsToRender(). If a function is passed in, then for each model, this function will be invoked to find the appropriate view class. It takes the model as the only parameter. The collection that will back this list view. A subclass of list view might provide a default collection. Can be private or public collection object or function that's passed to the item view's during initialization under the name "context". Can be used by the item view during their prepare method. allows a list view to hold it's own HTML like filter buttons, etc. (Required if 'template' is provided, ignored otherwise) name of injection site for list of item views if provided, this template will be shown if the modelsToRender() method returns an empty list. If a itemContainer is provided, the empty template will be rendered there. If provided, this function will override the modelsToRender() method with custom functionality. If provided, will collect any internally invoked renders (typically through collection events like reset) for a duration specified by renderWait in milliseconds and then calls a single render instead. Helps to remove unnecessary render calls when modifying the collection often. one of ('cid' or 'id'): model property used as identifier for a given model. This property is saved and used to find the corresponding view. name of the model argument passed to the item view during initialization The collection that holds the models that this list view will track The item view class definition that will be instantiated for each model in the list. The template that allows a list view to hold it's own HTML like filter buttons, etc. If provided, this template that will be shown if the modelsToRender() method returns (Required if 'template' is provided, ignored otherwise) name of injection site for list of item views Cell that can be used to save state for rendering the view. Sets the collection from which this view generates item views. the new collection that this list view should use. if true, the list view will not update the child views nor rerender. Builds a single DOM fragment from the item views and attaches it at once. Loops through children views and renders them Takes existing item views and moves them into correct order defined by Override if you want a different context for your empty template. Defaults to this.prepare() a context that can be used by the empty list template Returns an array of which models should be rendered. Builds any new views, removes stale ones, and re-renders Returns the view that corresponds to the model if one exists the item view corresponding to the model the model returns true if there exists any generated item views Returns unordered list of views generated by this list view Alias to this.viewState.get() Alias to this.viewState.set() Alias to this.viewState.has() Alias to this.viewState.unset() Alias to this.viewState.toJSON() the behavior instance if one exists with that alias the name/alias of the behavior prepareFields can be used to augment the default render method contents. context for a render method. Defaults to: Extension point to augment the template context with custom content. [Optional] If you return an object, it will be merged with the context the context you can modify Rebuilds the html for this view's element. Should be able to be called at any time. a promise that when resolved signifies that the rendering process is complete. Hook during render that is invoked before any DOM rendering is performed. you can optionally return one or more promises that when all are resolved, prerender is finished. Note: render logic will not wait until promises are resolved. Updates this view element's class attribute with the value provided. the new value of the class attribute Hook during render that is invoked after all DOM rendering is done and tracked views attached. you can optionally return one or more promises that when all are resolved, postrender is finished. Note: render logic will not wait until promises are resolved. Hotswap rendering system reroute method. Overrides the base delegateEvents Overrides undelegateEvents If detached, will replace the element passed in with this view's element and activate the view. promise that when resolved, the attach process is complete. Normally this method is synchronous. Transition effects can the element to attach to. This element will be replaced with this view. optional options if given, this view will invoke replaceMethod function if set to true, the injection site is not saved. Registers the view as a tracked view (defaulting as a child view), then calls view.attachTo with the element argument resolved when all transitions are complete. No payload is provided upon resolution. If no transitions, then returns a resolved promise. the element to attach to OR the name of the injection site. The element with the attribute "inject= The instantiated view object to be attached optionals options object. If using transitions, this options object will be passed on to the transitionIn and transitionOut methods as well. if set to true, the view will not be activated upon attaching. if set to true, the view will be treated as a shared view and not disposed during parent view disposing. if set to true, this method will delegate attach logic to this.__transitionNewViewIntoSite if true, and options.useTransition is true, the new view's element will be added before the previous view's element. Defaults to after. if using options.useTransition, then you can explicitly define the view that should be transitioned out. Hook to attach all your tracked views. This hook will be called after all DOM rendering is done so injection sites should be available. you can optionally return one or more promises that when all are resolved, all tracked views are attached. Useful when using this.attachView with useTransition=true. Method to be invoked when the view is fully attached to the DOM (NOT just the parent). Use this method to manipulate the view true if the view is attached to a parent NOTE: depends on a global variable "document" true if the view is attached to the DOM If attached, will detach the view from the DOM. Detach all tracked views or a subset of them based on the options parameter. Optional options. If true, detach only the shared views. These are views not owned by this parent. As compared to a child view If true, detach only child views. These are views that are owned by the parent and dispose of them if the parent is disposed. Method to be invoked when the view is detached from the DOM (NOT just the parent). Use this method to clean up state Resets listeners and events in order for the view to be reattached to the visible DOM Method to be invoked when activate is called. Use this method to turn on any true if the view is active Maintains view state and DOM but prevents view from becoming a zombie by removing listeners Method to be invoked when deactivate is called. Use this method to turn off any Removes all listeners, disposes children views, stops listening to events, removes DOM. Method to be invoked when dispose is called. By default calling dispose will remove the true if the view was disposed true if this view has tracked views (limited by the options parameter) Optional options. If true, only check the shared views. These are views not owned by this parent. As compared to a child view If true, only check the child views. These are views that are owned by the parent and dispose of them if the parent is disposed. Returns all tracked views, both child views and shared views. all tracked views (filtered by options parameter) Optional options. If true, get only the shared views. These are views not owned by this parent. As compared to a child view If true, get only child views. These are views that are owned by the parent and dispose of them if the parent is disposed. the view with the given cid. Will look in both shared and child views. the cid of the view Binds the view as a tracked view - any recursive calls like activate, deactivate, or dispose will the tracked view the tracked view Optional options. If true, registers view as a shared view. These are views not owned by this parent. As compared to a child view Unbinds the tracked view - no recursive calls will be made to this shared view the tracked view the shared view Unbinds all tracked view - no recursive calls will be made to this shared view the tracked view Optional options. If true, unregister only the shared views. These are views not owned by this parent. As compared to a child view If true, unregister only child views. These are views that are owned by the parent and dispose of them if the parent is disposed. Override to provide your own transition out logic. Default logic is to just detach from the page. callback that MUST be invoked when the transition is complete. optionals options object the view that is being transitioned in. the view that is being transitioned out. Typically this view. the view that is invoking the transition. Override to provide your own transition in logic. Default logic is to just attach to the page. callback to be invoked when you want this view to be attached to the dom. callback that MUST be invoked when the transition is complete. optionals options object the view that is being transitioned in. the view that is being transitioned out. Typically this view. the view that is invoking the transition. Invokes a feedback entry's "then" method the "to" field corresponding to the feedback entry to be invoked. the event to be passed to the "then" method a map from index variable name to index value. Needed for "to" fields with array notation. A view that is backed by a collection that managers views per model in the collection. Constructor for the list view object. options argument the class definition of the item view. This view will be instantiated for every model returned by modelsToRender(). If a function is passed in, then for each model, this function will be invoked to find the appropriate view class. It takes the model as the only parameter. The collection that will back this list view. A subclass of list view might provide a default collection. Can be private or public collection object or function that's passed to the item view's during initialization under the name "context". Can be used by the item view during their prepare method. allows a list view to hold it's own HTML like filter buttons, etc. (Required if 'template' is provided, ignored otherwise) name of injection site for list of item views if provided, this template will be shown if the modelsToRender() method returns an empty list. If a itemContainer is provided, the empty template will be rendered there. If provided, this function will override the modelsToRender() method with custom functionality. If provided, will collect any internally invoked renders (typically through collection events like reset) for a duration specified by renderWait in milliseconds and then calls a single render instead. Helps to remove unnecessary render calls when modifying the collection often. one of ('cid' or 'id'): model property used as identifier for a given model. This property is saved and used to find the corresponding view. name of the model argument passed to the item view during initialization The collection that holds the models that this list view will track The item view class definition that will be instantiated for each model in the list. The template that allows a list view to hold it's own HTML like filter buttons, etc. If provided, this template that will be shown if the modelsToRender() method returns (Required if 'template' is provided, ignored otherwise) name of injection site for list of item views Cell that can be used to save state for rendering the view. Sets the collection from which this view generates item views. the new collection that this list view should use. if true, the list view will not update the child views nor rerender. Builds a single DOM fragment from the item views and attaches it at once. Loops through children views and renders them Takes existing item views and moves them into correct order defined by Override if you want a different context for your empty template. Defaults to this.prepare() a context that can be used by the empty list template Returns an array of which models should be rendered. Builds any new views, removes stale ones, and re-renders Returns the view that corresponds to the model if one exists the item view corresponding to the model the model returns true if there exists any generated item views Returns unordered list of views generated by this list view Alias to this.viewState.get() Alias to this.viewState.set() Alias to this.viewState.has() Alias to this.viewState.unset() Alias to this.viewState.toJSON() the behavior instance if one exists with that alias the name/alias of the behavior prepareFields can be used to augment the default render method contents. context for a render method. Defaults to: Extension point to augment the template context with custom content. [Optional] If you return an object, it will be merged with the context the context you can modify Rebuilds the html for this view's element. Should be able to be called at any time. a promise that when resolved signifies that the rendering process is complete. Hook during render that is invoked before any DOM rendering is performed. you can optionally return one or more promises that when all are resolved, prerender is finished. Note: render logic will not wait until promises are resolved. Updates this view element's class attribute with the value provided. the new value of the class attribute Hook during render that is invoked after all DOM rendering is done and tracked views attached. you can optionally return one or more promises that when all are resolved, postrender is finished. Note: render logic will not wait until promises are resolved. Hotswap rendering system reroute method. Overrides the base delegateEvents Overrides undelegateEvents If detached, will replace the element passed in with this view's element and activate the view. promise that when resolved, the attach process is complete. Normally this method is synchronous. Transition effects can the element to attach to. This element will be replaced with this view. optional options if given, this view will invoke replaceMethod function if set to true, the injection site is not saved. Registers the view as a tracked view (defaulting as a child view), then calls view.attachTo with the element argument resolved when all transitions are complete. No payload is provided upon resolution. If no transitions, then returns a resolved promise. the element to attach to OR the name of the injection site. The element with the attribute "inject= The instantiated view object to be attached optionals options object. If using transitions, this options object will be passed on to the transitionIn and transitionOut methods as well. if set to true, the view will not be activated upon attaching. if set to true, the view will be treated as a shared view and not disposed during parent view disposing. if set to true, this method will delegate attach logic to this.__transitionNewViewIntoSite if true, and options.useTransition is true, the new view's element will be added before the previous view's element. Defaults to after. if using options.useTransition, then you can explicitly define the view that should be transitioned out. Hook to attach all your tracked views. This hook will be called after all DOM rendering is done so injection sites should be available. you can optionally return one or more promises that when all are resolved, all tracked views are attached. Useful when using this.attachView with useTransition=true. Method to be invoked when the view is fully attached to the DOM (NOT just the parent). Use this method to manipulate the view true if the view is attached to a parent NOTE: depends on a global variable "document" true if the view is attached to the DOM If attached, will detach the view from the DOM. Detach all tracked views or a subset of them based on the options parameter. Optional options. If true, detach only the shared views. These are views not owned by this parent. As compared to a child view If true, detach only child views. These are views that are owned by the parent and dispose of them if the parent is disposed. Method to be invoked when the view is detached from the DOM (NOT just the parent). Use this method to clean up state Resets listeners and events in order for the view to be reattached to the visible DOM Method to be invoked when activate is called. Use this method to turn on any true if the view is active Maintains view state and DOM but prevents view from becoming a zombie by removing listeners Method to be invoked when deactivate is called. Use this method to turn off any Removes all listeners, disposes children views, stops listening to events, removes DOM. Method to be invoked when dispose is called. By default calling dispose will remove the true if the view was disposed true if this view has tracked views (limited by the options parameter) Optional options. If true, only check the shared views. These are views not owned by this parent. As compared to a child view If true, only check the child views. These are views that are owned by the parent and dispose of them if the parent is disposed. Returns all tracked views, both child views and shared views. all tracked views (filtered by options parameter) Optional options. If true, get only the shared views. These are views not owned by this parent. As compared to a child view If true, get only child views. These are views that are owned by the parent and dispose of them if the parent is disposed. the view with the given cid. Will look in both shared and child views. the cid of the view Binds the view as a tracked view - any recursive calls like activate, deactivate, or dispose will the tracked view the tracked view Optional options. If true, registers view as a shared view. These are views not owned by this parent. As compared to a child view Unbinds the tracked view - no recursive calls will be made to this shared view the tracked view the shared view Unbinds all tracked view - no recursive calls will be made to this shared view the tracked view Optional options. If true, unregister only the shared views. These are views not owned by this parent. As compared to a child view If true, unregister only child views. These are views that are owned by the parent and dispose of them if the parent is disposed. Override to provide your own transition out logic. Default logic is to just detach from the page. callback that MUST be invoked when the transition is complete. optionals options object the view that is being transitioned in. the view that is being transitioned out. Typically this view. the view that is invoking the transition. Override to provide your own transition in logic. Default logic is to just attach to the page. callback to be invoked when you want this view to be attached to the dom. callback that MUST be invoked when the transition is complete. optionals options object the view that is being transitioned in. the view that is being transitioned out. Typically this view. the view that is invoking the transition. Invokes a feedback entry's "then" method the "to" field corresponding to the feedback entry to be invoked. the event to be passed to the "then" method a map from index variable name to index value. Needed for "to" fields with array notation. Generic Model the initial attributes to use for this model. the options for setting up this model. whether to register this model in the app-level registry. The id from when setTimeout was called to start polling. Returns true if the poll is active Starts polling Model/Collection by calling fetch every pollInterval. interval between each poll in ms. Stops polling Model and clears all Timeouts. By default, the polled fetching operation is routed directly Default dispose for model-like objects (Models, Cells, and ServiceCells). Dispose hook meant to be used by prototypes that extend this one that need to provide their own dispose logic. Generic Nested Cell the initial attributes to use for this cell. the options for setting up this cell. whether to register this cell in the app-level registry. Whether a cell can pass as a model or not. The id from when setTimeout was called to start polling. Override and disable the save function Override and disable the fetch function Override and disable the sync function Override and disable the url Returns true if the poll is active Starts polling Model/Collection by calling fetch every pollInterval. interval between each poll in ms. Stops polling Model and clears all Timeouts. By default, the polled fetching operation is routed directly Default dispose for model-like objects (Models, Cells, and ServiceCells). Dispose hook meant to be used by prototypes that extend this one that need to provide their own dispose logic. Generic Nested Model the initial attributes to use for this model. the options for setting up this model. whether to register this model in the app-level registry. The id from when setTimeout was called to start polling. Returns true if the poll is active Starts polling Model/Collection by calling fetch every pollInterval. interval between each poll in ms. Stops polling Model and clears all Timeouts. By default, the polled fetching operation is routed directly Default dispose for model-like objects (Models, Cells, and ServiceCells). Dispose hook meant to be used by prototypes that extend this one that need to provide their own dispose logic. Backbone's router. A service cell is a event listening and event emitting object that is independent of any model or view. the initial attributes to use for this service. the options for setting up this service. whether to register this service in the app-level registry. Whether a cell can pass as a model or not. Override and disable the save function Override and disable the fetch function Override and disable the sync function Override and disable the url ViewStateCell is a NestedCell that holds view state data and can trigger the initial values to set on the cell - inherited from [NestedCell](#NestedCell). options for the cell. the view that these options are tied to. the initial values to set on the cell - inherited from [NestedCell](#NestedCell). options for the cell. the view that these options are tied to. Whether a cell can pass as a model or not. The id from when setTimeout was called to start polling. Retrigger view state change events on the view as well. Override and disable the save function Override and disable the fetch function Override and disable the sync function Override and disable the url Returns true if the poll is active Starts polling Model/Collection by calling fetch every pollInterval. interval between each poll in ms. Stops polling Model and clears all Timeouts. By default, the polled fetching operation is routed directly Default dispose for model-like objects (Models, Cells, and ServiceCells). Dispose hook meant to be used by prototypes that extend this one that need to provide their own dispose logic. ViewStateCell is a NestedCell that holds view state data and can trigger the initial values to set on the cell - inherited from [NestedCell](#NestedCell). options for the cell. the view that these options are tied to. the initial values to set on the cell - inherited from [NestedCell](#NestedCell). options for the cell. the view that these options are tied to. Whether a cell can pass as a model or not. The id from when setTimeout was called to start polling. Retrigger view state change events on the view as well. Override and disable the save function Override and disable the fetch function Override and disable the sync function Override and disable the url Returns true if the poll is active Starts polling Model/Collection by calling fetch every pollInterval. interval between each poll in ms. Stops polling Model and clears all Timeouts. By default, the polled fetching operation is routed directly Default dispose for model-like objects (Models, Cells, and ServiceCells). Dispose hook meant to be used by prototypes that extend this one that need to provide their own dispose logic. View Overrides constructor to create needed fields and invoke activate/render after initialization Generic View that deals with: Cell that can be used to save state for rendering the view. Alias to this.viewState.get() Alias to this.viewState.set() Alias to this.viewState.has() Alias to this.viewState.unset() Alias to this.viewState.toJSON() the behavior instance if one exists with that alias the name/alias of the behavior prepareFields can be used to augment the default render method contents. context for a render method. Defaults to: Extension point to augment the template context with custom content. [Optional] If you return an object, it will be merged with the context the context you can modify Rebuilds the html for this view's element. Should be able to be called at any time. a promise that when resolved signifies that the rendering process is complete. Hook during render that is invoked before any DOM rendering is performed. you can optionally return one or more promises that when all are resolved, prerender is finished. Note: render logic will not wait until promises are resolved. Produces and sets this view's elements DOM. Used during the rendering process. Override if you have custom DOM update logic. Updates this view element's class attribute with the value provided. the new value of the class attribute Hook during render that is invoked after all DOM rendering is done and tracked views attached. you can optionally return one or more promises that when all are resolved, postrender is finished. Note: render logic will not wait until promises are resolved. Hotswap rendering system reroute method. Overrides the base delegateEvents Overrides undelegateEvents If detached, will replace the element passed in with this view's element and activate the view. promise that when resolved, the attach process is complete. Normally this method is synchronous. Transition effects can the element to attach to. This element will be replaced with this view. optional options if given, this view will invoke replaceMethod function if set to true, the injection site is not saved. Registers the view as a tracked view (defaulting as a child view), then calls view.attachTo with the element argument resolved when all transitions are complete. No payload is provided upon resolution. If no transitions, then returns a resolved promise. the element to attach to OR the name of the injection site. The element with the attribute "inject= The instantiated view object to be attached optionals options object. If using transitions, this options object will be passed on to the transitionIn and transitionOut methods as well. if set to true, the view will not be activated upon attaching. if set to true, the view will be treated as a shared view and not disposed during parent view disposing. if set to true, this method will delegate attach logic to this.__transitionNewViewIntoSite if true, and options.useTransition is true, the new view's element will be added before the previous view's element. Defaults to after. if using options.useTransition, then you can explicitly define the view that should be transitioned out. Hook to attach all your tracked views. This hook will be called after all DOM rendering is done so injection sites should be available. you can optionally return one or more promises that when all are resolved, all tracked views are attached. Useful when using this.attachView with useTransition=true. Method to be invoked when the view is fully attached to the DOM (NOT just the parent). Use this method to manipulate the view true if the view is attached to a parent NOTE: depends on a global variable "document" true if the view is attached to the DOM If attached, will detach the view from the DOM. Detach all tracked views or a subset of them based on the options parameter. Optional options. If true, detach only the shared views. These are views not owned by this parent. As compared to a child view If true, detach only child views. These are views that are owned by the parent and dispose of them if the parent is disposed. Method to be invoked when the view is detached from the DOM (NOT just the parent). Use this method to clean up state Resets listeners and events in order for the view to be reattached to the visible DOM Method to be invoked when activate is called. Use this method to turn on any true if the view is active Maintains view state and DOM but prevents view from becoming a zombie by removing listeners Method to be invoked when deactivate is called. Use this method to turn off any Removes all listeners, disposes children views, stops listening to events, removes DOM. Method to be invoked when dispose is called. By default calling dispose will remove the true if the view was disposed true if this view has tracked views (limited by the options parameter) Optional options. If true, only check the shared views. These are views not owned by this parent. As compared to a child view If true, only check the child views. These are views that are owned by the parent and dispose of them if the parent is disposed. Returns all tracked views, both child views and shared views. all tracked views (filtered by options parameter) Optional options. If true, get only the shared views. These are views not owned by this parent. As compared to a child view If true, get only child views. These are views that are owned by the parent and dispose of them if the parent is disposed. the view with the given cid. Will look in both shared and child views. the cid of the view Binds the view as a tracked view - any recursive calls like activate, deactivate, or dispose will the tracked view the tracked view Optional options. If true, registers view as a shared view. These are views not owned by this parent. As compared to a child view Unbinds the tracked view - no recursive calls will be made to this shared view the tracked view the shared view Unbinds all tracked view - no recursive calls will be made to this shared view the tracked view Optional options. If true, unregister only the shared views. These are views not owned by this parent. As compared to a child view If true, unregister only child views. These are views that are owned by the parent and dispose of them if the parent is disposed. Override to provide your own transition out logic. Default logic is to just detach from the page. callback that MUST be invoked when the transition is complete. optionals options object the view that is being transitioned in. the view that is being transitioned out. Typically this view. the view that is invoking the transition. Override to provide your own transition in logic. Default logic is to just attach to the page. callback to be invoked when you want this view to be attached to the dom. callback that MUST be invoked when the transition is complete. optionals options object the view that is being transitioned in. the view that is being transitioned out. Typically this view. the view that is invoking the transition. Invokes a feedback entry's "then" method the "to" field corresponding to the feedback entry to be invoked. the event to be passed to the "then" method a map from index variable name to index value. Needed for "to" fields with array notation. Backbone's history object. Registry of instantiated Torso objects The registered cells keyed by their unique cid. The registered models keyed by their unique cid. The registered services keyed by their unique cid. The registered views keyed by their unique cid. The prefix to use for this object's cid. Add the model to the model cache when it is initialized. the model to add to the models cache. Add the cell to the cell cache when it is initialized. the cell to add to the cells cache. Add the view to the view cache when it is initialized. the view to add to the views cache. Add the service to the model service when it is initialized. the service to add to the services cache. Dispose of all items in all of the caches (Models, Cells, Services and Views). Dispose of all items in the Models cache. Dispose of all items in the Cells cache. Dispose of all items in the Services cache. Dispose of all items in the Views cache. This behavior implements simplified interaction with data sources (i.e. TorsoCollection). Unique name of the behavior instance w/in a view. More human readable than the cid. cidPrefix of Behaviors Add functions to be added to the view's public API. They will be behavior-scoped. The behavior's prepare result will be combined with the view's prepare with the behavior's alias as the namespace. a prepare context suitable to being added to the view's prepare result. Method to be invoked when dispose is called. By default calling dispose will remove the true if the view was disposed The torso collection that is acting as a cache used to create the private collections. Adds a listener on the Behavior for the Skip triggering a load of this data behavior when the view completes initializing. Determines the result of Determines whether Duck-typed property that identifies the ids to use. id or ids is required (either by behavior options or as properties). {(string|number)} - the id to use directly (equivalent to an array of a single id). {(string[]|number[])} - the ids to use directly. {Object} - more complex configuration that identifies a model-like object that fires a change event and the {Function(cache)} - expected to return the ids (either array, jquery deferred that resolves to the ids or single primitive) cause this behavior to re-calculate its ids and refetch them from the server if the given events are triggered Object that manages interaction with the data. Contains the privateCollection, proxies all events from the privateCollection, The possible fetched statuses. This is the status value of the fetched event payload. SUCCESS: 'SUCCESS', FAILURE: 'FAILURE' } FETCHED_STATUSES the initial state of the behavior. see cache property. see renderOnFetch property. see skipInitialLoad property. see returnSingleResult property. see alwaysFetch property. see id property. see ids property. see updateEvents property. options passed to View's initialize Retrieves the ids for this data object and passes them off to the private collection to track and then does a a jquery deferred promise that resolves to the retrieved models. Retrieves the ids for this data object and passes them off to the private collection's trackAndPull() method. a jquery deferred promise that resolves to the retrieved models. Retrieves the ids for this data object and passes them off to the private collection's trackAndFetch() method. a jquery deferred promise that resolves to the retrieved models. Adds the toJSON of the data represented by this behavior to the context. Determine if the behavior is loading objects or ids. true - the behavior is currently loading objects or ids. Determine if the behavior is loading ids. true - the behavior is currently loading ids. Determine if the behavior is loading objects. true - the behavior is currently loading objects. Listens for the change event on the ids property and, if triggered, re-fetches the data based on the new ids. Removes the listener added by listenToIdsPropertyChangeEvent(). This is a good way to have something be called after at least one retrieve (pull or fetch) has completed. This can also be done purely by listening for the 'fetched' event, but you might miss the event if it is fired This also gives the ability to distinguish between a successful and failed fetch easily using the promises Usage: someDataBehavior.retrieveOncePromise() that resolves when the data is successfully fetched and rejects when the fetch fails. Data object used to create the .data property of the DataBehavior. Returns a new class of collection that inherits from the parent but not the cacheMixin the parent of the private collection the unique code of the owner of this private collection The id from when setTimeout was called to start polling. array of ids that this collection is tracking Will force the cache to fetch just the registered ids of this collection promise that will resolve when the fetch is complete argument options A list of request Ids, will default to current tracked ids if a set is made, then the setOptions will be passed into the set method Will force the cache to fetch a subset of this collection's tracked ids promise that will resolve when the fetch is complete array of model ids if given, will pass the options argument to this.fetch. Note, will not affect options.idsToFetch Pass a list of ids to begin tracking. This will reset any previous list of ids being tracked. The list of ids that this collection wants to track Adds a new model to the requester collection and tracks the model.id the model to be added Tracks a new id the id attribute of the model Will begin tracking the new ids and then ask the cache to fetch them the promise of the fetch by ids Will force the cache to fetch any of this collection's tracked models that are not in the cache If the ids being fetched are already being fetched by the cache, then they will not be re-fetched. The resulting promise is resolved when ALL items in the process of being fetched have completed. promise that will resolve when the fetch is complete with all of the data that was fetched from the server. if given, will pass the options argument to this.fetch. Note, will not affect options.idsToFetch Will register the new ids and then pull in any models not stored in the cache. See this.pull() for the promise of the fetch by ids Handles the disposing of this collection as it relates to a requester collection. In addition to removing the model from the collection also remove it from the list of tracked ids. same duck-typing as Backbone.Collection.get(): The default filter. Always returns itself. a new instance of this collection Will abolish all listeners and events that are hooked Returns true if the poll is active Starts polling Model/Collection by calling fetch every pollInterval. interval between each poll in ms. Stops polling Model and clears all Timeouts. By default, the polled fetching operation is routed directly Adds the loading mixin the arguments to the base constructor method true if this model/collection has ever loaded from a fetch call true if this model/collection is currently loading new values from the server a promise that will resolve when the model/collection has loaded for the first time an array of the ids the requester with the guid has requested global unique id of the requester This method is used for quick look up of a certain id within the list of requested ids an dictionary of id -> id of the requester ids for a given requester. the global unique id of the requester Removes a requester from this cache. No longer receives updates the global unique id of the requester NOTE: this methods returns only the guids for requester collections that are currently tracking ids an array of the all requesters in the form of their GUID's Return the list of Ids requested by this collection the corresponding requested Ids Used to return a collection of desired models given the requester object. an new empty collection of the same type as "this" Identifier for the requesting view Registers a list of Ids that a particular object cares about and pushes This method intelligently updates the "_requestedIds" field to contain all unique New ids to register under the requester The GUID of the object that wants the ids Contains the methods that are mixed in on the model when binding Check whether an attribute or a set of attributes are valid. It will default to use the model's current values but undefined if no errors, a validation exception if a single attribute, or an object with attribute name as key Either the name of the attribute, an array containing many attribute names, or a value to use for the attribute value instead of using the model's value. Check to see if an attribute, an array of attributes or the This is called by Backbone when it needs to perform validation. Custom additions to the Backbone Collection object. an array of the ids the requester with the guid has requested global unique id of the requester This method is used for quick look up of a certain id within the list of requested ids an dictionary of id -> id of the requester ids for a given requester. the global unique id of the requester Removes a requester from this cache. No longer receives updates the global unique id of the requester NOTE: this methods returns only the guids for requester collections that are currently tracking ids an array of the all requesters in the form of their GUID's Return the list of Ids requested by this collection the corresponding requested Ids Used to return a collection of desired models given the requester object. an new empty collection of the same type as "this" Identifier for the requesting view Registers a list of Ids that a particular object cares about and pushes This method intelligently updates the "_requestedIds" field to contain all unique New ids to register under the requester The GUID of the object that wants the ids Overrides the base fetch call if this.fetchUsingTrackedIds is true A custom fetch operation to only fetch the requested Ids. the promise of the fetch argument fetchByIdsOptions A list of request Ids, will default to current tracked ids if a set is made, then the setOptions will be passed into the set method The constructor constructor / initialize method for collections. optional options object http action used to get objects by ids path appended to collection.url to get objects by a list of ids if set to false, cache.fetch() will not pass to fetchByIds with current tracked ids An non-persistable object that can listen to and emit events like a models. Whether a cell can pass as a model or not. Override and disable the save function Override and disable the fetch function Override and disable the sync function Override and disable the url Loading logic. Adds the loading mixin the arguments to the base constructor method true if this model/collection has ever loaded from a fetch call true if this model/collection is currently loading new values from the server a promise that will resolve when the model/collection has loaded for the first time Wraps the base fetch in a wrapper that manages loaded states The loadWrapper promise the object to hold the options needed by the base fetch method The base for a model Default dispose for model-like objects (Models, Cells, and ServiceCells). Dispose hook meant to be used by prototypes that extend this one that need to provide their own dispose logic. Periodic Polling Object to be mixed into Backbone Collections and Models. The polling functionality should only be used for collections and for models that are not The id from when setTimeout was called to start polling. Returns true if the poll is active Starts polling Model/Collection by calling fetch every pollInterval. interval between each poll in ms. Stops polling Model and clears all Timeouts. By default, the polled fetching operation is routed directly Usage: Generates: for="field-name-suffix" Usage: Generates: for="field-name-123_sub-demo" Usage: Generates: for="field-name_abc_sub-demo" Compliant HTML generating the "for" attribute The field name to convert to a compliant "for" attribute The handlebars context. Always passed in as the final argument. The value tacked on to the end of the field string (useful for radio and checkbox) Usage: Generates: id="field-name-suffix" name="field-name" data-model="fieldName" data-feedback="fieldName" value="demo" Usage: Generates: data-model="fieldName[123].sub" data-feedback="fieldName[123].sub" name="field-name-123_sub" Usage: Generates: data-model="fieldName.abc.sub" data-feedback="fieldName[abc].sub" name="field-name_abc_sub" Compliant HTML generating the id, name, data-model, and data-feedback attributes The field name to convert to compliant id, name, data-model, and data-feedback attributes The handlebars context. Always passed in as the final argument. The value tacked on to the end of the field string (useful for radio and checkbox) Usage: Generates: data-feedback="fieldName" Usage: Generates: data-feedback="fieldName[123].sub" Usage: Generates: data-feedback="fieldName[abc].sub" Compliant HTML generating the data-feedback attribute The field name to convert to a compliant data-feedback attribute The handlebars context. Always passed in as the final argument. Usage: Generates: id="field-name-123_sub-demo" for="field-name-123_sub-demo" value="demo" Usage: Generates: id="field-name_abc_sub-demo" for="field-name_abc_sub-demo" value="demo" Compliant HTML generating the data-feedback attribute The field name to convert to a compliant data-feedback attribute The handlebars context. Always passed in as the final argument. The value tacked on to the end of the field string (useful for radio and checkbox) when options.noValueAttr is set to true, Usage: Generates: field-name[x]_sub HTML complicant / dasherized string The input string to make HTML compliant (convert to dashes) Usage: injectFieldIndices('test[x]-thisIsRegular-y', {x: 123, y: 456} and 'foo[x].abc', x='bar'); Generates: 'test[123]-thisIsRegular-y' and 'foo.bar.abc' if options.forceArrayNotation is set then: Generates: 'test[123]-thisIsRegular-y' and 'foo[bar].abc' the field string with array variables substituted The field name A map of variables named parameters Force the usage of [] insetad of . for string values. Static Template Engine. Changes DOM Nodes that are different, and leaves others untouched. Algorithm: The DOM Node corresponding to the existing page content to update The detached DOM Node representing the desired DOM subtree Array of jQuery selectors for DOM Elements to ignore during render. Can be an expensive check. Performs efficient re-rendering of a template. The Element to render into The HBS template to apply The context object to pass to the template Other options Will forcefully do a fresh render and not a diff-render If you pass in newHTML, it will not use the template or context, but use this instead. jQuery selectors of DOM elements to ignore during render. Can be an expensive check Call this.hotswap but also keeps the caret position the same The DOM Node corresponding to the existing page content to update The detached DOM Node representing the desired DOM subtree Array of jQuery selectors for DOM Elements to ignore during render. Can be an expensive check. Produces a copy of the element tag with attributes but with no contents a shallow copy of the element with no children but with attributes the DOM element to be copied Determines if the element supports selection. As per spec, https://html.spec.whatwg.org/multipage/forms.html#do-not-apply boolean indicating whether or not the selection is allowed for {Element} el the DOM element to check Method that returns the current caret (cursor) position of a given element. the cursor index of the given element. the DOM element to check caret position Method that returns sets the current caret (cursor) position of a given element and puts it in focus. the cursor index of the given element. The caret index to set Module containing all dependencies that exports a single object with everything attached (same format as the global). The [Behavior](#Behavior) prototype. Collection of behaviors that ship with Torso. The [DataBehavior](#DataBehavior) prototype. The [Cell](#Cell) prototype. The [Collection](#Collection) prototype. The [Events](#Events) prototype. Collection of mixins that are used by Torso. The [loadingMixin](#loadingMixin). The [cacheMixin](#cacheMixin). The [pollingMixin](#pollingMixin). The [validationMixin](#validationMixin). The [cellMixin](#cellMixin). The [Model](#Model) prototype. The [NestedCell](#NestedCell) prototype. The [NestedModel](#NestedModel) prototype. The [FormModel](#FormModel) prototype. The [ServiceCell](#ServiceCell) prototype. The [Router](#Router) prototype. Convient access to backbone history. The torso object registry. Collection of utilities used by Torso. Template renderer used by Torso. Handlebars utilities used by Torso. The [validation](validation) prototype. The [View](#View) prototype. The [ListView](#ListView) prototype. The [FormView](#FormView) prototype. Validation object containing validation mixin. Current version of the library Used to extend the Backbone.Model.prototype with validation Called to augment configure the default options Extensions to handlebars helpers. Adds additonal helpers to [Handlebars](#external_Handlebars) Add the helpers to this Handlebars object. Extensions to stickit handlers. The backbone Collection reference The backbone Events reference The backbone Model reference The Backbone-Nested reference The backbone Router reference The backbone View reference The handlebars reference The handlebars Template reference The backbone History reference The jQuery reference The jQuery Deferred reference The backbone View reference
This method can be overwritten as usual OR extended using
NOTE: if you require the view to be detached from the DOM, consider using _detach callback</p>
**Kind**: instance method of [FormView
](#FormView)
**Returns**: Promise
\| Array.<Promise>
-
Defaults to using the stanrdard: this.templateRender(this.$el, this.template, this.prepare(), templateRendererOptions);
this.templateRendererOptions is an object or function defined on the view that is passed into the renderer.
Examples include: views with no template or multiple templates, or if you wish to use a different rendering engine than the templateRenderer or wish to pass options to it.FormView
](#FormView)
### formView.updateClassName(newClassName)
If no value provided, removes the class attribute of this view element.FormView
](#FormView)
| Param | Type | Description |
| --- | --- | --- |
| newClassName | string
| Promise
\| Array.<Promise>
This method can be overwritten as usual OR extended using
NOTE: if you require the view to be attached to the DOM, consider using _attach callback</p>
**Kind**: instance method of [FormView
](#FormView)
**Returns**: Promise
\| Array.<Promise>
-
See Torso.templateRenderer#render for paramsFormView
](#FormView)
### formView.undelegateEvents()
Unbinds DOM events from the view.FormView
](#FormView)
### formView.attachTo([$el], [options]) ⇒ Promise
FormView
](#FormView)
**Returns**: Promise
-
make it asynchronous.jQuery
](#external_jQuery) | |
If options.replaceMethod is provided, then this parameter is ignored.Object
| | Fucntion
| |
in order to attach the view's DOM to the parent instead of calling $el.replaceWithBooleon
| false
| Promise
The element argument can be a String that references an element with the corresponding "inject" attribute.
When using attachView with options.useTransition:
Will inject a new view into an injection site by using the new view's transitionIn method. If the parent view
previously had another view at this injections site, this previous view will be removed with that view's transitionOut.
If this method is used within a render, the current views' injection sites will be cached so they can be transitioned out even
though they are detached in the process of re-rendering. If no previous view is given and none can be found, the new view is transitioned in regardless.
If the previous view is the same as the new view, it is injected normally without transitioning in.
The previous view must has used an injection site with the standard "inject=
When the transitionIn and transitionOut methods are invoked on the new and previous views, the options parameter will be passed on to them. Other fields
will be added to the options parameter to allow better handling of the transitions. These include:
{
newView: the new view
previousView: the previous view (can be undefined)
parentView: the parent view transitioning in or out the tracked view
}</p>
**Kind**: instance method of [FormView
](#FormView)
**Returns**: Promise
- jQuery
](#external_jQuery) \| string
| | View
](#View) | | Object
| | boolean
| false
| boolean
| false
| boolean
| false
| boolean
| false
| View
](#View) | |
If using transitions and no previousView is provided, it will look to see if a view already is at this injection site and uses that by default.Promise
\| Array.<Promise>
This method can be overwritten as usual OR extended using FormView
](#FormView)
**Returns**: Promise
\| Array.<Promise>
-
after the DOM has been attached to the document. The default implementation is a no-op.FormView
](#FormView)
### formView.isAttachedToParent() ⇒ boolean
**Kind**: instance method of [FormView
](#FormView)
**Returns**: boolean
- boolean
FormView
](#FormView)
**Returns**: boolean
-
This method will only separate this view from the DOM it was attached to, but it WILL invoke the _detach
callback on each tracked view recursively.FormView
](#FormView)
### formView.detachTrackedViews([options])
NOTE: this is not recursive - it will not separate the entire view tree.FormView
](#FormView)
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [options] | Object
| {}
| boolean
| false
|
which are disposed when the parent is disposed.boolean
| false
|
after the view has been removed from the document. The default implementation is a no-op.FormView
](#FormView)
### formView.activate()
FormView
](#FormView)
### formView.\_activate()
custom timers, listenTo's or on's that should be activatable. The default implementation is a no-op.FormView
](#FormView)
### formView.isActive() ⇒ boolean
**Kind**: instance method of [FormView
](#FormView)
**Returns**: boolean
-
custom timers, listenTo's or on's that should be deactivatable. The default implementation is a no-op.FormView
](#FormView)
### formView.dispose()
After dispose is called, the view can be safely garbage collected. Called while
recursively removing views from the hierarchy.FormView
](#FormView)
### formView.\_dispose()
view's element, its on's, listenTo's, and any registered children.
Override this method to destruct any extraFormView
](#FormView)
### formView.isDisposed() ⇒ boolean
**Kind**: instance method of [FormView
](#FormView)
**Returns**: boolean
- boolean
**Kind**: instance method of [FormView
](#FormView)
**Returns**: boolean
- Object
| {}
| boolean
| false
|
which are disposed when the parent is disposed.boolean
| false
| List.<View>
](#View)
FormView
](#FormView)
**Returns**: [List.<View>
](#View) - Object
| {}
| boolean
| false
|
which are disposed when the parent is disposed.boolean
| false
| FormView
](#FormView)
**Returns**: string
| View
](#View)
be done to the tracked view as well. Except dispose for shared views. This method defaults to register the
view as a child view unless specified by options.shared.FormView
](#FormView)
**Returns**: [View
](#View) - View
](#View) | | Object
| {}
| boolean
| false
|
which are disposed when the parent is disposed. If false, registers view as a child view which are disposed when the parent is disposed.View
](#View)
FormView
](#FormView)
**Returns**: [View
](#View) - View
](#View) | View
](#View)
You can limit the types of views that will be unregistered by using the options parameter.FormView
](#FormView)
**Returns**: [View
](#View) - Object
| {}
| boolean
| false
|
which are disposed when the parent is disposed.boolean
| false
|
The method is passed a callback that should be invoked when the transition out has fully completed.FormView
](#FormView)
| Param | Type | Description |
| --- | --- | --- |
| done | function
| View
](#View) | View
](#View) | View
](#View) |
The method is passed a callback that should be invoked when the transition in has fully completed.FormView
](#FormView)
| Param | Type | Description |
| --- | --- | --- |
| attach | function
|
If you are trying to transition in a tracked view, consider using this.transitionInView()function
| View
](#View) | View
](#View) | View
](#View) | FormView
](#FormView)
| Param | Type | Description |
| --- | --- | --- |
| to | string
| Event
| Object
| View
](#View)
**Kind**: global class
**Extends**: [View
](#View)
**See**: ListView Annotated Source
**Author**: ariel.wexler@vecna.com, kent.willis@vecna.com
* [ListView](#ListView) ⇐ [View
](#View)
* [new ListView()](#new_ListView_new)
* [new constructor(args)](#new_ListView_new)
* [.collection](#ListView+collection) : [Collection
](#Collection)
* [.itemView](#ListView+itemView) : [View
](#View) \| function
* [.template](#ListView+template) : [Handlebars-Template
](#external_Handlebars-Template)
* [.emptyTemplate](#ListView+emptyTemplate) : [Handlebars-Template
](#external_Handlebars-Template)
* [.itemContainer](#ListView+itemContainer) : String
* [.viewState](#View+viewState) : [ViewStateCell
](#ViewStateCell)
* [.setCollection(collection, preventUpdate)](#ListView+setCollection)
* [.updateDOM()](#ListView+updateDOM)
* [.renderChildViews()](#ListView+renderChildViews)
* [.reorder()](#ListView+reorder)
* [.prepareEmpty()](#ListView+prepareEmpty) ⇒
* [.modelsToRender()](#ListView+modelsToRender)
* [.update()](#ListView+update)
* [.getItemViewFromModel(model)](#ListView+getItemViewFromModel) ⇒
* [.hasItemViews()](#ListView+hasItemViews) ⇒ boolean
* [.getItemViews()](#ListView+getItemViews) ⇒ [Array.<View>
](#View)
* [.get()](#View+get)
* [.set()](#View+set)
* [.has()](#View+has)
* [.unset()](#View+unset)
* [.toJSON()](#View+toJSON)
* [.getBehavior(alias)](#View+getBehavior) ⇒ Torso.Behavior
* [.prepare()](#View+prepare) ⇒ Object
* [._prepare(context)](#View+_prepare) ⇒ Object
* [.render()](#View+render) ⇒ Promise
* [.prerender()](#View+prerender) ⇒ Promise
\| Array.<Promise>
* [.updateClassName(newClassName)](#View+updateClassName)
* [.postrender()](#View+postrender) ⇒ Promise
\| Array.<Promise>
* [.templateRender()](#View+templateRender)
* [.delegateEvents()](#View+delegateEvents)
* [.undelegateEvents()](#View+undelegateEvents)
* [.attachTo([$el], [options])](#View+attachTo) ⇒ Promise
* [.attachView($el, view, [options])](#View+attachView) ⇒ Promise
* [.attachTrackedViews()](#View+attachTrackedViews) ⇒ Promise
\| Array.<Promise>
* [._attached()](#View+_attached)
* [.isAttachedToParent()](#View+isAttachedToParent) ⇒ boolean
* [.isAttached()](#View+isAttached) ⇒ boolean
* [.detach()](#View+detach)
* [.detachTrackedViews([options])](#View+detachTrackedViews)
* [._detached()](#View+_detached)
* [.activate()](#View+activate)
* [._activate()](#View+_activate)
* [.isActive()](#View+isActive) ⇒ boolean
* [.deactivate()](#View+deactivate)
* [._deactivate()](#View+_deactivate)
* [.dispose()](#View+dispose)
* [._dispose()](#View+_dispose)
* [.isDisposed()](#View+isDisposed) ⇒ boolean
* [.hasTrackedViews([options])](#View+hasTrackedViews) ⇒ boolean
* [.getTrackedViews([options])](#View+getTrackedViews) ⇒ [List.<View>
](#View)
* [.getTrackedView(viewCID)](#View+getTrackedView) ⇒
* [.registerTrackedView(view, [options])](#View+registerTrackedView) ⇒ [View
](#View)
* [.unregisterTrackedView(view)](#View+unregisterTrackedView) ⇒ [View
](#View)
* [.unregisterTrackedViews([options])](#View+unregisterTrackedViews) ⇒ [View
](#View)
* [.transitionOut(done, options)](#View+transitionOut)
* [.transitionIn(attach, done, options)](#View+transitionIn)
* [.invokeFeedback(to, [evt], [indexMap])](#View+invokeFeedback)
### new ListView()
Object
| | Backbone-View
](#external_Backbone-View) \| function
| | Backbone-Collection
](#external_Backbone-Collection) | | Object
\| function
| | Handlebars-Template
](#external_Handlebars-Template) | | string
| | Handlebars-Template
](#external_Handlebars-Template) | | function
| | number
| 0
| string
| "'cid'"
| string
| "'model'"
| Collection
](#Collection)
ListView
](#ListView)
**Properties**
| Name |
| --- |
| collection |
### listView.itemView : [View
](#View) \| function
itemView can also be a function that takes a model and returns a view class. This allows
for different view classes depending on the model.ListView
](#ListView)
**Properties**
| Name |
| --- |
| itemView |
### listView.template : [Handlebars-Template
](#external_Handlebars-Template)
ListView
](#ListView)
**Properties**
| Name |
| --- |
| template |
### listView.emptyTemplate : [Handlebars-Template
](#external_Handlebars-Template)
an empty list. If an itemContainer is provided, the empty template will be rendered there.ListView
](#ListView)
**Properties**
| Name |
| --- |
| emptyTemplate |
### listView.itemContainer : String
ListView
](#ListView)
**Properties**
| Name |
| --- |
| itemContainer |
### listView.viewState : [ViewStateCell
](#ViewStateCell)
ListView
](#ListView)
### listView.setCollection(collection, preventUpdate)
This method will attach all necessary event listeners to the new collection to auto-generate item views
and has the option of removing listeners on a previous collection. It will immediately update child
views and re-render if it is necessary - this behavior can be prevented with preventUpdate argumentListView
](#ListView)
| Param | Type | Description |
| --- | --- | --- |
| collection | [Backbone-Collection
](#external_Backbone-Collection) | boolean
| ListView
](#ListView)
**Overrides**: [updateDOM
](#View+updateDOM)
### listView.renderChildViews()
ListView
](#ListView)
### listView.reorder()
this.modelsToRender(). NOTE: As this method doesn't generate or remove views,
this method takes advantage of jquery's ability to move elements already attached to the DOM.ListView
](#ListView)
### listView.prepareEmpty() ⇒
ListView
](#ListView)
**Returns**:
By default, all models in the input collection will be
shown. Extensions of this class may override this
method to apply collection filters.ListView
](#ListView)
### listView.update()
ListView
](#ListView)
### listView.getItemViewFromModel(model) ⇒
ListView
](#ListView)
**Returns**: Model
](#Model) | boolean
**Kind**: instance method of [ListView
](#ListView)
**Returns**: boolean
- Array.<View>
](#View)
**Kind**: instance method of [ListView
](#ListView)
**Returns**: [Array.<View>
](#View) - ListView
](#ListView)
### listView.set()
ListView
](#ListView)
### listView.has()
ListView
](#ListView)
### listView.unset()
ListView
](#ListView)
### listView.toJSON()
ListView
](#ListView)
### listView.getBehavior(alias) ⇒ Torso.Behavior
**Kind**: instance method of [ListView
](#ListView)
**Returns**: Torso.Behavior
- string
| Object
See __getPrepareFieldsContext() for more details on how to configure them.ListView
](#ListView)
**Returns**: Object
-
{view: this.viewState.toJSON(), model: this.model.toJSON()}Object
ListView
](#ListView)
**Returns**: Object
- Promise
Defaults to using this.templateRender. Assumes that this.template is a javascript
function that accepted a single JSON context.
The render method returns a promise that resolves when rendering is complete. Typically render
is synchronous and the rendering is complete upon completion of the method. However, when utilizing
transitions/animations, the render process can be asynchronous and the promise is useful to know when it has finished.ListView
](#ListView)
**Returns**: Promise
- Promise
\| Array.<Promise>
This method can be overwritten as usual OR extended using
NOTE: if you require the view to be detached from the DOM, consider using _detach callback</p>
**Kind**: instance method of [ListView
](#ListView)
**Returns**: Promise
\| Array.<Promise>
-
If no value provided, removes the class attribute of this view element.ListView
](#ListView)
| Param | Type | Description |
| --- | --- | --- |
| newClassName | string
| Promise
\| Array.<Promise>
This method can be overwritten as usual OR extended using
NOTE: if you require the view to be attached to the DOM, consider using _attach callback</p>
**Kind**: instance method of [ListView
](#ListView)
**Returns**: Promise
\| Array.<Promise>
-
See Torso.templateRenderer#render for paramsListView
](#ListView)
### listView.delegateEvents()
Binds DOM events with the view using events hash while also adding feedback event bindingsListView
](#ListView)
### listView.undelegateEvents()
Unbinds DOM events from the view.ListView
](#ListView)
### listView.attachTo([$el], [options]) ⇒ Promise
ListView
](#ListView)
**Returns**: Promise
-
make it asynchronous.jQuery
](#external_jQuery) | |
If options.replaceMethod is provided, then this parameter is ignored.Object
| | Fucntion
| |
in order to attach the view's DOM to the parent instead of calling $el.replaceWithBooleon
| false
| Promise
The element argument can be a String that references an element with the corresponding "inject" attribute.
When using attachView with options.useTransition:
Will inject a new view into an injection site by using the new view's transitionIn method. If the parent view
previously had another view at this injections site, this previous view will be removed with that view's transitionOut.
If this method is used within a render, the current views' injection sites will be cached so they can be transitioned out even
though they are detached in the process of re-rendering. If no previous view is given and none can be found, the new view is transitioned in regardless.
If the previous view is the same as the new view, it is injected normally without transitioning in.
The previous view must has used an injection site with the standard "inject=
When the transitionIn and transitionOut methods are invoked on the new and previous views, the options parameter will be passed on to them. Other fields
will be added to the options parameter to allow better handling of the transitions. These include:
{
newView: the new view
previousView: the previous view (can be undefined)
parentView: the parent view transitioning in or out the tracked view
}</p>
**Kind**: instance method of [ListView
](#ListView)
**Returns**: Promise
- jQuery
](#external_jQuery) \| string
| | View
](#View) | | Object
| | boolean
| false
| boolean
| false
| boolean
| false
| boolean
| false
| View
](#View) | |
If using transitions and no previousView is provided, it will look to see if a view already is at this injection site and uses that by default.Promise
\| Array.<Promise>
This method can be overwritten as usual OR extended using ListView
](#ListView)
**Returns**: Promise
\| Array.<Promise>
-
after the DOM has been attached to the document. The default implementation is a no-op.ListView
](#ListView)
### listView.isAttachedToParent() ⇒ boolean
**Kind**: instance method of [ListView
](#ListView)
**Returns**: boolean
- boolean
ListView
](#ListView)
**Returns**: boolean
-
This method will only separate this view from the DOM it was attached to, but it WILL invoke the _detach
callback on each tracked view recursively.ListView
](#ListView)
### listView.detachTrackedViews([options])
NOTE: this is not recursive - it will not separate the entire view tree.ListView
](#ListView)
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [options] | Object
| {}
| boolean
| false
|
which are disposed when the parent is disposed.boolean
| false
|
after the view has been removed from the document. The default implementation is a no-op.ListView
](#ListView)
### listView.activate()
ListView
](#ListView)
### listView.\_activate()
custom timers, listenTo's or on's that should be activatable. The default implementation is a no-op.ListView
](#ListView)
### listView.isActive() ⇒ boolean
**Kind**: instance method of [ListView
](#ListView)
**Returns**: boolean
-
and events that may affect user experience. Recursively invokes deactivate on child viewsListView
](#ListView)
### listView.\_deactivate()
custom timers, listenTo's or on's that should be deactivatable. The default implementation is a no-op.ListView
](#ListView)
### listView.dispose()
After dispose is called, the view can be safely garbage collected. Called while
recursively removing views from the hierarchy.ListView
](#ListView)
### listView.\_dispose()
view's element, its on's, listenTo's, and any registered children.
Override this method to destruct any extraListView
](#ListView)
### listView.isDisposed() ⇒ boolean
**Kind**: instance method of [ListView
](#ListView)
**Returns**: boolean
- boolean
**Kind**: instance method of [ListView
](#ListView)
**Returns**: boolean
- Object
| {}
| boolean
| false
|
which are disposed when the parent is disposed.boolean
| false
| List.<View>
](#View)
ListView
](#ListView)
**Returns**: [List.<View>
](#View) - Object
| {}
| boolean
| false
|
which are disposed when the parent is disposed.boolean
| false
| ListView
](#ListView)
**Returns**: string
| View
](#View)
be done to the tracked view as well. Except dispose for shared views. This method defaults to register the
view as a child view unless specified by options.shared.ListView
](#ListView)
**Returns**: [View
](#View) - View
](#View) | | Object
| {}
| boolean
| false
|
which are disposed when the parent is disposed. If false, registers view as a child view which are disposed when the parent is disposed.View
](#View)
ListView
](#ListView)
**Returns**: [View
](#View) - View
](#View) | View
](#View)
You can limit the types of views that will be unregistered by using the options parameter.ListView
](#ListView)
**Returns**: [View
](#View) - Object
| {}
| boolean
| false
|
which are disposed when the parent is disposed.boolean
| false
|
The method is passed a callback that should be invoked when the transition out has fully completed.ListView
](#ListView)
| Param | Type | Description |
| --- | --- | --- |
| done | function
| View
](#View) | View
](#View) | View
](#View) |
The method is passed a callback that should be invoked when the transition in has fully completed.ListView
](#ListView)
| Param | Type | Description |
| --- | --- | --- |
| attach | function
|
If you are trying to transition in a tracked view, consider using this.transitionInView()function
| View
](#View) | View
](#View) | View
](#View) | ListView
](#ListView)
| Param | Type | Description |
| --- | --- | --- |
| to | string
| Event
| Object
| Collection
](#Collection)
* [.itemView](#ListView+itemView) : [View
](#View) \| function
* [.template](#ListView+template) : [Handlebars-Template
](#external_Handlebars-Template)
* [.emptyTemplate](#ListView+emptyTemplate) : [Handlebars-Template
](#external_Handlebars-Template)
* [.itemContainer](#ListView+itemContainer) : String
* [.viewState](#View+viewState) : [ViewStateCell
](#ViewStateCell)
* [.setCollection(collection, preventUpdate)](#ListView+setCollection)
* [.updateDOM()](#ListView+updateDOM)
* [.renderChildViews()](#ListView+renderChildViews)
* [.reorder()](#ListView+reorder)
* [.prepareEmpty()](#ListView+prepareEmpty) ⇒
* [.modelsToRender()](#ListView+modelsToRender)
* [.update()](#ListView+update)
* [.getItemViewFromModel(model)](#ListView+getItemViewFromModel) ⇒
* [.hasItemViews()](#ListView+hasItemViews) ⇒ boolean
* [.getItemViews()](#ListView+getItemViews) ⇒ [Array.<View>
](#View)
* [.get()](#View+get)
* [.set()](#View+set)
* [.has()](#View+has)
* [.unset()](#View+unset)
* [.toJSON()](#View+toJSON)
* [.getBehavior(alias)](#View+getBehavior) ⇒ Torso.Behavior
* [.prepare()](#View+prepare) ⇒ Object
* [._prepare(context)](#View+_prepare) ⇒ Object
* [.render()](#View+render) ⇒ Promise
* [.prerender()](#View+prerender) ⇒ Promise
\| Array.<Promise>
* [.updateClassName(newClassName)](#View+updateClassName)
* [.postrender()](#View+postrender) ⇒ Promise
\| Array.<Promise>
* [.templateRender()](#View+templateRender)
* [.delegateEvents()](#View+delegateEvents)
* [.undelegateEvents()](#View+undelegateEvents)
* [.attachTo([$el], [options])](#View+attachTo) ⇒ Promise
* [.attachView($el, view, [options])](#View+attachView) ⇒ Promise
* [.attachTrackedViews()](#View+attachTrackedViews) ⇒ Promise
\| Array.<Promise>
* [._attached()](#View+_attached)
* [.isAttachedToParent()](#View+isAttachedToParent) ⇒ boolean
* [.isAttached()](#View+isAttached) ⇒ boolean
* [.detach()](#View+detach)
* [.detachTrackedViews([options])](#View+detachTrackedViews)
* [._detached()](#View+_detached)
* [.activate()](#View+activate)
* [._activate()](#View+_activate)
* [.isActive()](#View+isActive) ⇒ boolean
* [.deactivate()](#View+deactivate)
* [._deactivate()](#View+_deactivate)
* [.dispose()](#View+dispose)
* [._dispose()](#View+_dispose)
* [.isDisposed()](#View+isDisposed) ⇒ boolean
* [.hasTrackedViews([options])](#View+hasTrackedViews) ⇒ boolean
* [.getTrackedViews([options])](#View+getTrackedViews) ⇒ [List.<View>
](#View)
* [.getTrackedView(viewCID)](#View+getTrackedView) ⇒
* [.registerTrackedView(view, [options])](#View+registerTrackedView) ⇒ [View
](#View)
* [.unregisterTrackedView(view)](#View+unregisterTrackedView) ⇒ [View
](#View)
* [.unregisterTrackedViews([options])](#View+unregisterTrackedViews) ⇒ [View
](#View)
* [.transitionOut(done, options)](#View+transitionOut)
* [.transitionIn(attach, done, options)](#View+transitionIn)
* [.invokeFeedback(to, [evt], [indexMap])](#View+invokeFeedback)
### new ListView()
Object
| | Backbone-View
](#external_Backbone-View) \| function
| | Backbone-Collection
](#external_Backbone-Collection) | | Object
\| function
| | Handlebars-Template
](#external_Handlebars-Template) | | string
| | Handlebars-Template
](#external_Handlebars-Template) | | function
| | number
| 0
| string
| "'cid'"
| string
| "'model'"
| Collection
](#Collection)
ListView
](#ListView)
**Properties**
| Name |
| --- |
| collection |
### listView.itemView : [View
](#View) \| function
itemView can also be a function that takes a model and returns a view class. This allows
for different view classes depending on the model.ListView
](#ListView)
**Properties**
| Name |
| --- |
| itemView |
### listView.template : [Handlebars-Template
](#external_Handlebars-Template)
ListView
](#ListView)
**Properties**
| Name |
| --- |
| template |
### listView.emptyTemplate : [Handlebars-Template
](#external_Handlebars-Template)
an empty list. If an itemContainer is provided, the empty template will be rendered there.ListView
](#ListView)
**Properties**
| Name |
| --- |
| emptyTemplate |
### listView.itemContainer : String
ListView
](#ListView)
**Properties**
| Name |
| --- |
| itemContainer |
### listView.viewState : [ViewStateCell
](#ViewStateCell)
ListView
](#ListView)
### listView.setCollection(collection, preventUpdate)
This method will attach all necessary event listeners to the new collection to auto-generate item views
and has the option of removing listeners on a previous collection. It will immediately update child
views and re-render if it is necessary - this behavior can be prevented with preventUpdate argumentListView
](#ListView)
| Param | Type | Description |
| --- | --- | --- |
| collection | [Backbone-Collection
](#external_Backbone-Collection) | boolean
| ListView
](#ListView)
**Overrides**: [updateDOM
](#View+updateDOM)
### listView.renderChildViews()
ListView
](#ListView)
### listView.reorder()
this.modelsToRender(). NOTE: As this method doesn't generate or remove views,
this method takes advantage of jquery's ability to move elements already attached to the DOM.ListView
](#ListView)
### listView.prepareEmpty() ⇒
ListView
](#ListView)
**Returns**:
By default, all models in the input collection will be
shown. Extensions of this class may override this
method to apply collection filters.ListView
](#ListView)
### listView.update()
ListView
](#ListView)
### listView.getItemViewFromModel(model) ⇒
ListView
](#ListView)
**Returns**: Model
](#Model) | boolean
**Kind**: instance method of [ListView
](#ListView)
**Returns**: boolean
- Array.<View>
](#View)
**Kind**: instance method of [ListView
](#ListView)
**Returns**: [Array.<View>
](#View) - ListView
](#ListView)
### listView.set()
ListView
](#ListView)
### listView.has()
ListView
](#ListView)
### listView.unset()
ListView
](#ListView)
### listView.toJSON()
ListView
](#ListView)
### listView.getBehavior(alias) ⇒ Torso.Behavior
**Kind**: instance method of [ListView
](#ListView)
**Returns**: Torso.Behavior
- string
| Object
See __getPrepareFieldsContext() for more details on how to configure them.ListView
](#ListView)
**Returns**: Object
-
{view: this.viewState.toJSON(), model: this.model.toJSON()}Object
ListView
](#ListView)
**Returns**: Object
- Promise
Defaults to using this.templateRender. Assumes that this.template is a javascript
function that accepted a single JSON context.
The render method returns a promise that resolves when rendering is complete. Typically render
is synchronous and the rendering is complete upon completion of the method. However, when utilizing
transitions/animations, the render process can be asynchronous and the promise is useful to know when it has finished.ListView
](#ListView)
**Returns**: Promise
- Promise
\| Array.<Promise>
This method can be overwritten as usual OR extended using
NOTE: if you require the view to be detached from the DOM, consider using _detach callback</p>
**Kind**: instance method of [ListView
](#ListView)
**Returns**: Promise
\| Array.<Promise>
-
If no value provided, removes the class attribute of this view element.ListView
](#ListView)
| Param | Type | Description |
| --- | --- | --- |
| newClassName | string
| Promise
\| Array.<Promise>
This method can be overwritten as usual OR extended using
NOTE: if you require the view to be attached to the DOM, consider using _attach callback</p>
**Kind**: instance method of [ListView
](#ListView)
**Returns**: Promise
\| Array.<Promise>
-
See Torso.templateRenderer#render for paramsListView
](#ListView)
### listView.delegateEvents()
Binds DOM events with the view using events hash while also adding feedback event bindingsListView
](#ListView)
### listView.undelegateEvents()
Unbinds DOM events from the view.ListView
](#ListView)
### listView.attachTo([$el], [options]) ⇒ Promise
ListView
](#ListView)
**Returns**: Promise
-
make it asynchronous.jQuery
](#external_jQuery) | |
If options.replaceMethod is provided, then this parameter is ignored.Object
| | Fucntion
| |
in order to attach the view's DOM to the parent instead of calling $el.replaceWithBooleon
| false
| Promise
The element argument can be a String that references an element with the corresponding "inject" attribute.
When using attachView with options.useTransition:
Will inject a new view into an injection site by using the new view's transitionIn method. If the parent view
previously had another view at this injections site, this previous view will be removed with that view's transitionOut.
If this method is used within a render, the current views' injection sites will be cached so they can be transitioned out even
though they are detached in the process of re-rendering. If no previous view is given and none can be found, the new view is transitioned in regardless.
If the previous view is the same as the new view, it is injected normally without transitioning in.
The previous view must has used an injection site with the standard "inject=
When the transitionIn and transitionOut methods are invoked on the new and previous views, the options parameter will be passed on to them. Other fields
will be added to the options parameter to allow better handling of the transitions. These include:
{
newView: the new view
previousView: the previous view (can be undefined)
parentView: the parent view transitioning in or out the tracked view
}</p>
**Kind**: instance method of [ListView
](#ListView)
**Returns**: Promise
- jQuery
](#external_jQuery) \| string
| | View
](#View) | | Object
| | boolean
| false
| boolean
| false
| boolean
| false
| boolean
| false
| View
](#View) | |
If using transitions and no previousView is provided, it will look to see if a view already is at this injection site and uses that by default.Promise
\| Array.<Promise>
This method can be overwritten as usual OR extended using ListView
](#ListView)
**Returns**: Promise
\| Array.<Promise>
-
after the DOM has been attached to the document. The default implementation is a no-op.ListView
](#ListView)
### listView.isAttachedToParent() ⇒ boolean
**Kind**: instance method of [ListView
](#ListView)
**Returns**: boolean
- boolean
ListView
](#ListView)
**Returns**: boolean
-
This method will only separate this view from the DOM it was attached to, but it WILL invoke the _detach
callback on each tracked view recursively.ListView
](#ListView)
### listView.detachTrackedViews([options])
NOTE: this is not recursive - it will not separate the entire view tree.ListView
](#ListView)
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [options] | Object
| {}
| boolean
| false
|
which are disposed when the parent is disposed.boolean
| false
|
after the view has been removed from the document. The default implementation is a no-op.ListView
](#ListView)
### listView.activate()
ListView
](#ListView)
### listView.\_activate()
custom timers, listenTo's or on's that should be activatable. The default implementation is a no-op.ListView
](#ListView)
### listView.isActive() ⇒ boolean
**Kind**: instance method of [ListView
](#ListView)
**Returns**: boolean
-
and events that may affect user experience. Recursively invokes deactivate on child viewsListView
](#ListView)
### listView.\_deactivate()
custom timers, listenTo's or on's that should be deactivatable. The default implementation is a no-op.ListView
](#ListView)
### listView.dispose()
After dispose is called, the view can be safely garbage collected. Called while
recursively removing views from the hierarchy.ListView
](#ListView)
### listView.\_dispose()
view's element, its on's, listenTo's, and any registered children.
Override this method to destruct any extraListView
](#ListView)
### listView.isDisposed() ⇒ boolean
**Kind**: instance method of [ListView
](#ListView)
**Returns**: boolean
- boolean
**Kind**: instance method of [ListView
](#ListView)
**Returns**: boolean
- Object
| {}
| boolean
| false
|
which are disposed when the parent is disposed.boolean
| false
| List.<View>
](#View)
ListView
](#ListView)
**Returns**: [List.<View>
](#View) - Object
| {}
| boolean
| false
|
which are disposed when the parent is disposed.boolean
| false
| ListView
](#ListView)
**Returns**: string
| View
](#View)
be done to the tracked view as well. Except dispose for shared views. This method defaults to register the
view as a child view unless specified by options.shared.ListView
](#ListView)
**Returns**: [View
](#View) - View
](#View) | | Object
| {}
| boolean
| false
|
which are disposed when the parent is disposed. If false, registers view as a child view which are disposed when the parent is disposed.View
](#View)
ListView
](#ListView)
**Returns**: [View
](#View) - View
](#View) | View
](#View)
You can limit the types of views that will be unregistered by using the options parameter.ListView
](#ListView)
**Returns**: [View
](#View) - Object
| {}
| boolean
| false
|
which are disposed when the parent is disposed.boolean
| false
|
The method is passed a callback that should be invoked when the transition out has fully completed.ListView
](#ListView)
| Param | Type | Description |
| --- | --- | --- |
| done | function
| View
](#View) | View
](#View) | View
](#View) |
The method is passed a callback that should be invoked when the transition in has fully completed.ListView
](#ListView)
| Param | Type | Description |
| --- | --- | --- |
| attach | function
|
If you are trying to transition in a tracked view, consider using this.transitionInView()function
| View
](#View) | View
](#View) | View
](#View) | ListView
](#ListView)
| Param | Type | Description |
| --- | --- | --- |
| to | string
| Event
| Object
| Backbone-Model
](#external_Backbone-Model)
**Kind**: global class
**Extends**: [Backbone-Model
](#external_Backbone-Model)
**Mixes**: [pollingMixin
](#pollingMixin), [modelMixin
](#modelMixin)
**See**: Model Annotated Source
**Author**: kent.willis@vecna.com
* [Model](#Model) ⇐ [Backbone-Model
](#external_Backbone-Model)
* [new Model(attributes, [options])](#new_Model_new)
* [.pollTimeoutId](#Model+pollTimeoutId)
* [.isPolling()](#Model+isPolling)
* [.startPolling(pollInterval)](#Model+startPolling)
* [.stopPolling()](#Model+stopPolling)
* [.polledFetch()](#Model+polledFetch)
* [.dispose()](#Model+dispose)
* [._dispose()](#Model+_dispose)
### new Model(attributes, [options])
Object
| | Object
| {}
| boolean
| false
|
By default this will NOT add it to the registry unless set to true because
we have not mechanism that will make sure the models get removed from the registry
at the appropriate times.Model
](#Model)
**Mixes**: [pollTimeoutId
](#pollingMixin.pollTimeoutId)
**Properties**
| Name | Type | Description |
| --- | --- | --- |
| pollTimeoutId | number
| Model
](#Model)
**Mixes**: [isPolling
](#pollingMixin.isPolling)
### model.startPolling(pollInterval)
Note: Each Model/Collection will only allow a singleton of polling to occur so
as not to have duplicate threads updating Model/Collection.Model
](#Model)
**Mixes**: [startPolling
](#pollingMixin.startPolling)
| Param | Type | Description |
| --- | --- | --- |
| pollInterval | Integer
| Model
](#Model)
**Mixes**: [stopPolling
](#pollingMixin.stopPolling)
### model.polledFetch()
to backbone's fetch all.Model
](#Model)
**Mixes**: [polledFetch
](#pollingMixin.polledFetch)
### model.dispose()
Removes listeners and calls out to _dispose() for child specific dispose logic.
Triggers 2 events - "before-dispose" and "after-dispose".Model
](#Model)
**Mixes**: [dispose
](#modelMixin.dispose)
### model.\_dispose()
Model
](#Model)
**Mixes**: [\_dispose
](#modelMixin._dispose)
## NestedCell ⇐ [NestedModel
](#NestedModel)
**Kind**: global class
**Extends**: [NestedModel
](#NestedModel)
**Mixes**: [cellMixin
](#cellMixin)
**See**: NestedCell Annotated Source
**Author**: kent.willis@vecna.com
* [NestedCell](#NestedCell) ⇐ [NestedModel
](#NestedModel)
* [new NestedCell(attributes, [options])](#new_NestedCell_new)
* [.isModelCompatible](#NestedCell+isModelCompatible)
* [.pollTimeoutId](#NestedModel+pollTimeoutId)
* [.save()](#NestedCell+save)
* [.fetch()](#NestedCell+fetch)
* [.sync()](#NestedCell+sync)
* [.url()](#NestedCell+url)
* [.isPolling()](#NestedModel+isPolling)
* [.startPolling(pollInterval)](#NestedModel+startPolling)
* [.stopPolling()](#NestedModel+stopPolling)
* [.polledFetch()](#NestedModel+polledFetch)
* [.dispose()](#NestedModel+dispose)
* [._dispose()](#NestedModel+_dispose)
### new NestedCell(attributes, [options])
Object
| | Object
| {}
| boolean
| false
|
By default this will NOT add it to the registry unless set to true because
we have not mechanism that will make sure the models get removed from the registry
at the appropriate times.
If true, the cell will not fail is persisted functions are invoked
If false, the cell will throw exceptions if persisted function are invokedNestedCell
](#NestedCell)
**Mixes**: [isModelCompatible
](#cellMixin.isModelCompatible)
**Default**: false
**Properties**
| Name | Type |
| --- | --- |
| isModelCompatible | boolean
|
### nestedCell.pollTimeoutId
**Kind**: instance property of [NestedCell
](#NestedCell)
**Mixes**: [pollTimeoutId
](#pollingMixin.pollTimeoutId)
**Properties**
| Name | Type | Description |
| --- | --- | --- |
| pollTimeoutId | number
| NestedCell
](#NestedCell)
**Mixes**: [save
](#cellMixin.save)
### nestedCell.fetch()
NestedCell
](#NestedCell)
**Mixes**: [fetch
](#cellMixin.fetch)
### nestedCell.sync()
NestedCell
](#NestedCell)
**Mixes**: [sync
](#cellMixin.sync)
### nestedCell.url()
NestedCell
](#NestedCell)
**Mixes**: [url
](#cellMixin.url)
### nestedCell.isPolling()
NestedCell
](#NestedCell)
**Mixes**: [isPolling
](#pollingMixin.isPolling)
### nestedCell.startPolling(pollInterval)
Note: Each Model/Collection will only allow a singleton of polling to occur so
as not to have duplicate threads updating Model/Collection.NestedCell
](#NestedCell)
**Mixes**: [startPolling
](#pollingMixin.startPolling)
| Param | Type | Description |
| --- | --- | --- |
| pollInterval | Integer
| NestedCell
](#NestedCell)
**Mixes**: [stopPolling
](#pollingMixin.stopPolling)
### nestedCell.polledFetch()
to backbone's fetch all.NestedCell
](#NestedCell)
**Mixes**: [polledFetch
](#pollingMixin.polledFetch)
### nestedCell.dispose()
Removes listeners and calls out to _dispose() for child specific dispose logic.
Triggers 2 events - "before-dispose" and "after-dispose".NestedCell
](#NestedCell)
**Mixes**: [dispose
](#modelMixin.dispose)
### nestedCell.\_dispose()
NestedCell
](#NestedCell)
**Mixes**: [\_dispose
](#modelMixin._dispose)
## NestedModel ⇐ [Backbone-NestedModel
](#external_Backbone-NestedModel)
**Kind**: global class
**Extends**: [Backbone-NestedModel
](#external_Backbone-NestedModel)
**Mixes**: [pollingMixin
](#pollingMixin), [modelMixin
](#modelMixin)
**See**: NestedModel Annotated Source
**Author**: kent.willis@vecna.com
* [NestedModel](#NestedModel) ⇐ [Backbone-NestedModel
](#external_Backbone-NestedModel)
* [new NestedModel(attributes, [options])](#new_NestedModel_new)
* [.pollTimeoutId](#NestedModel+pollTimeoutId)
* [.isPolling()](#NestedModel+isPolling)
* [.startPolling(pollInterval)](#NestedModel+startPolling)
* [.stopPolling()](#NestedModel+stopPolling)
* [.polledFetch()](#NestedModel+polledFetch)
* [.dispose()](#NestedModel+dispose)
* [._dispose()](#NestedModel+_dispose)
### new NestedModel(attributes, [options])
Object
| | Object
| {}
| boolean
| false
|
By default this will NOT add it to the registry unless set to true because
we have not mechanism that will make sure the models get removed from the registry
at the appropriate times.NestedModel
](#NestedModel)
**Mixes**: [pollTimeoutId
](#pollingMixin.pollTimeoutId)
**Properties**
| Name | Type | Description |
| --- | --- | --- |
| pollTimeoutId | number
| NestedModel
](#NestedModel)
**Mixes**: [isPolling
](#pollingMixin.isPolling)
### nestedModel.startPolling(pollInterval)
Note: Each Model/Collection will only allow a singleton of polling to occur so
as not to have duplicate threads updating Model/Collection.NestedModel
](#NestedModel)
**Mixes**: [startPolling
](#pollingMixin.startPolling)
| Param | Type | Description |
| --- | --- | --- |
| pollInterval | Integer
| NestedModel
](#NestedModel)
**Mixes**: [stopPolling
](#pollingMixin.stopPolling)
### nestedModel.polledFetch()
to backbone's fetch all.NestedModel
](#NestedModel)
**Mixes**: [polledFetch
](#pollingMixin.polledFetch)
### nestedModel.dispose()
Removes listeners and calls out to _dispose() for child specific dispose logic.
Triggers 2 events - "before-dispose" and "after-dispose".NestedModel
](#NestedModel)
**Mixes**: [dispose
](#modelMixin.dispose)
### nestedModel.\_dispose()
NestedModel
](#NestedModel)
**Mixes**: [\_dispose
](#modelMixin._dispose)
## Router ⇐ [Backbone-Router
](#external_Backbone-Router)
**Kind**: global class
**Extends**: [Backbone-Router
](#external_Backbone-Router)
**See**: Router Annotated Source
**Author**: kent.willis@vecna.com
### new Router()
Cell
](#Cell)
**Kind**: global class
**Extends**: [Cell
](#Cell)
**See**: ServiceCell Annotated Source
**Author**: kent.willis@vecna.com
* [ServiceCell](#ServiceCell) ⇐ [Cell
](#Cell)
* [new ServiceCell(attributes, [options])](#new_ServiceCell_new)
* [.isModelCompatible](#Cell+isModelCompatible)
* [.save()](#Cell+save)
* [.fetch()](#Cell+fetch)
* [.sync()](#Cell+sync)
* [.url()](#Cell+url)
### new ServiceCell(attributes, [options])
Object
| | Object
| {}
| boolean
| true
|
By default this WILL add it to the registry unless set to false because
most services are global so holding on to them beyond
If true, the cell will not fail is persisted functions are invoked
If false, the cell will throw exceptions if persisted function are invokedServiceCell
](#ServiceCell)
**Mixes**: [isModelCompatible
](#cellMixin.isModelCompatible)
**Default**: false
**Properties**
| Name | Type |
| --- | --- |
| isModelCompatible | boolean
|
### serviceCell.save()
ServiceCell
](#ServiceCell)
**Mixes**: [save
](#cellMixin.save)
### serviceCell.fetch()
ServiceCell
](#ServiceCell)
**Mixes**: [fetch
](#cellMixin.fetch)
### serviceCell.sync()
ServiceCell
](#ServiceCell)
**Mixes**: [sync
](#cellMixin.sync)
### serviceCell.url()
ServiceCell
](#ServiceCell)
**Mixes**: [url
](#cellMixin.url)
## ViewStateCell ⇐ [NestedCell
](#NestedCell)
**Kind**: global class
**Extends**: [NestedCell
](#NestedCell)
**See**: View Annotated Source
* [ViewStateCell](#ViewStateCell) ⇐ [NestedCell
](#NestedCell)
* [new ViewStateCell(attrs, opts)](#new_ViewStateCell_new)
* [new initialize(attrs, opts)](#new_ViewStateCell_new)
* [.isModelCompatible](#NestedCell+isModelCompatible)
* [.pollTimeoutId](#NestedModel+pollTimeoutId)
* [.trigger()](#ViewStateCell+trigger)
* [.save()](#NestedCell+save)
* [.fetch()](#NestedCell+fetch)
* [.sync()](#NestedCell+sync)
* [.url()](#NestedCell+url)
* [.isPolling()](#NestedModel+isPolling)
* [.startPolling(pollInterval)](#NestedModel+startPolling)
* [.stopPolling()](#NestedModel+stopPolling)
* [.polledFetch()](#NestedModel+polledFetch)
* [.dispose()](#NestedModel+dispose)
* [._dispose()](#NestedModel+_dispose)
### new ViewStateCell(attrs, opts)
change events. These change events will propagate up and trigger on the view
as well.Object
| Object
| Backbone-View
](#external_Backbone-View) | Object
| Object
| Backbone-View
](#external_Backbone-View) |
If true, the cell will not fail is persisted functions are invoked
If false, the cell will throw exceptions if persisted function are invokedViewStateCell
](#ViewStateCell)
**Mixes**: [isModelCompatible
](#cellMixin.isModelCompatible)
**Default**: false
**Properties**
| Name | Type |
| --- | --- |
| isModelCompatible | boolean
|
### viewStateCell.pollTimeoutId
**Kind**: instance property of [ViewStateCell
](#ViewStateCell)
**Mixes**: [pollTimeoutId
](#pollingMixin.pollTimeoutId)
**Properties**
| Name | Type | Description |
| --- | --- | --- |
| pollTimeoutId | number
| ViewStateCell
](#ViewStateCell)
### viewStateCell.save()
ViewStateCell
](#ViewStateCell)
**Mixes**: [save
](#cellMixin.save)
### viewStateCell.fetch()
ViewStateCell
](#ViewStateCell)
**Mixes**: [fetch
](#cellMixin.fetch)
### viewStateCell.sync()
ViewStateCell
](#ViewStateCell)
**Mixes**: [sync
](#cellMixin.sync)
### viewStateCell.url()
ViewStateCell
](#ViewStateCell)
**Mixes**: [url
](#cellMixin.url)
### viewStateCell.isPolling()
ViewStateCell
](#ViewStateCell)
**Mixes**: [isPolling
](#pollingMixin.isPolling)
### viewStateCell.startPolling(pollInterval)
Note: Each Model/Collection will only allow a singleton of polling to occur so
as not to have duplicate threads updating Model/Collection.ViewStateCell
](#ViewStateCell)
**Mixes**: [startPolling
](#pollingMixin.startPolling)
| Param | Type | Description |
| --- | --- | --- |
| pollInterval | Integer
| ViewStateCell
](#ViewStateCell)
**Mixes**: [stopPolling
](#pollingMixin.stopPolling)
### viewStateCell.polledFetch()
to backbone's fetch all.ViewStateCell
](#ViewStateCell)
**Mixes**: [polledFetch
](#pollingMixin.polledFetch)
### viewStateCell.dispose()
Removes listeners and calls out to _dispose() for child specific dispose logic.
Triggers 2 events - "before-dispose" and "after-dispose".ViewStateCell
](#ViewStateCell)
**Mixes**: [dispose
](#modelMixin.dispose)
### viewStateCell.\_dispose()
ViewStateCell
](#ViewStateCell)
**Mixes**: [\_dispose
](#modelMixin._dispose)
## ViewStateCell
**Kind**: global class
* [ViewStateCell](#ViewStateCell)
* [new ViewStateCell(attrs, opts)](#new_ViewStateCell_new)
* [new initialize(attrs, opts)](#new_ViewStateCell_new)
* [.isModelCompatible](#NestedCell+isModelCompatible)
* [.pollTimeoutId](#NestedModel+pollTimeoutId)
* [.trigger()](#ViewStateCell+trigger)
* [.save()](#NestedCell+save)
* [.fetch()](#NestedCell+fetch)
* [.sync()](#NestedCell+sync)
* [.url()](#NestedCell+url)
* [.isPolling()](#NestedModel+isPolling)
* [.startPolling(pollInterval)](#NestedModel+startPolling)
* [.stopPolling()](#NestedModel+stopPolling)
* [.polledFetch()](#NestedModel+polledFetch)
* [.dispose()](#NestedModel+dispose)
* [._dispose()](#NestedModel+_dispose)
### new ViewStateCell(attrs, opts)
change events. These change events will propagate up and trigger on the view
as well.Object
| Object
| Backbone-View
](#external_Backbone-View) | Object
| Object
| Backbone-View
](#external_Backbone-View) |
If true, the cell will not fail is persisted functions are invoked
If false, the cell will throw exceptions if persisted function are invokedViewStateCell
](#ViewStateCell)
**Mixes**: [isModelCompatible
](#cellMixin.isModelCompatible)
**Default**: false
**Properties**
| Name | Type |
| --- | --- |
| isModelCompatible | boolean
|
### viewStateCell.pollTimeoutId
**Kind**: instance property of [ViewStateCell
](#ViewStateCell)
**Mixes**: [pollTimeoutId
](#pollingMixin.pollTimeoutId)
**Properties**
| Name | Type | Description |
| --- | --- | --- |
| pollTimeoutId | number
| ViewStateCell
](#ViewStateCell)
### viewStateCell.save()
ViewStateCell
](#ViewStateCell)
**Mixes**: [save
](#cellMixin.save)
### viewStateCell.fetch()
ViewStateCell
](#ViewStateCell)
**Mixes**: [fetch
](#cellMixin.fetch)
### viewStateCell.sync()
ViewStateCell
](#ViewStateCell)
**Mixes**: [sync
](#cellMixin.sync)
### viewStateCell.url()
ViewStateCell
](#ViewStateCell)
**Mixes**: [url
](#cellMixin.url)
### viewStateCell.isPolling()
ViewStateCell
](#ViewStateCell)
**Mixes**: [isPolling
](#pollingMixin.isPolling)
### viewStateCell.startPolling(pollInterval)
Note: Each Model/Collection will only allow a singleton of polling to occur so
as not to have duplicate threads updating Model/Collection.ViewStateCell
](#ViewStateCell)
**Mixes**: [startPolling
](#pollingMixin.startPolling)
| Param | Type | Description |
| --- | --- | --- |
| pollInterval | Integer
| ViewStateCell
](#ViewStateCell)
**Mixes**: [stopPolling
](#pollingMixin.stopPolling)
### viewStateCell.polledFetch()
to backbone's fetch all.ViewStateCell
](#ViewStateCell)
**Mixes**: [polledFetch
](#pollingMixin.polledFetch)
### viewStateCell.dispose()
Removes listeners and calls out to _dispose() for child specific dispose logic.
Triggers 2 events - "before-dispose" and "after-dispose".ViewStateCell
](#ViewStateCell)
**Mixes**: [dispose
](#modelMixin.dispose)
### viewStateCell.\_dispose()
ViewStateCell
](#ViewStateCell)
**Mixes**: [\_dispose
](#modelMixin._dispose)
## View ⇐ [Backbone-View
](#external_Backbone-View)
Backbone-View
](#external_Backbone-View)
**See**: View Annotated Source
**Author**: ariel.wexler@vecna.com, kent.willis@vecna.com
* [View](#View) ⇐ [Backbone-View
](#external_Backbone-View)
* [new constructor()](#new_View_new)
* [.viewState](#View+viewState) : [ViewStateCell
](#ViewStateCell)
* [.get()](#View+get)
* [.set()](#View+set)
* [.has()](#View+has)
* [.unset()](#View+unset)
* [.toJSON()](#View+toJSON)
* [.getBehavior(alias)](#View+getBehavior) ⇒ Torso.Behavior
* [.prepare()](#View+prepare) ⇒ Object
* [._prepare(context)](#View+_prepare) ⇒ Object
* [.render()](#View+render) ⇒ Promise
* [.prerender()](#View+prerender) ⇒ Promise
\| Array.<Promise>
* [.updateDOM()](#View+updateDOM)
* [.updateClassName(newClassName)](#View+updateClassName)
* [.postrender()](#View+postrender) ⇒ Promise
\| Array.<Promise>
* [.templateRender()](#View+templateRender)
* [.delegateEvents()](#View+delegateEvents)
* [.undelegateEvents()](#View+undelegateEvents)
* [.attachTo([$el], [options])](#View+attachTo) ⇒ Promise
* [.attachView($el, view, [options])](#View+attachView) ⇒ Promise
* [.attachTrackedViews()](#View+attachTrackedViews) ⇒ Promise
\| Array.<Promise>
* [._attached()](#View+_attached)
* [.isAttachedToParent()](#View+isAttachedToParent) ⇒ boolean
* [.isAttached()](#View+isAttached) ⇒ boolean
* [.detach()](#View+detach)
* [.detachTrackedViews([options])](#View+detachTrackedViews)
* [._detached()](#View+_detached)
* [.activate()](#View+activate)
* [._activate()](#View+_activate)
* [.isActive()](#View+isActive) ⇒ boolean
* [.deactivate()](#View+deactivate)
* [._deactivate()](#View+_deactivate)
* [.dispose()](#View+dispose)
* [._dispose()](#View+_dispose)
* [.isDisposed()](#View+isDisposed) ⇒ boolean
* [.hasTrackedViews([options])](#View+hasTrackedViews) ⇒ boolean
* [.getTrackedViews([options])](#View+getTrackedViews) ⇒ [List.<View>
](#View)
* [.getTrackedView(viewCID)](#View+getTrackedView) ⇒
* [.registerTrackedView(view, [options])](#View+registerTrackedView) ⇒ [View
](#View)
* [.unregisterTrackedView(view)](#View+unregisterTrackedView) ⇒ [View
](#View)
* [.unregisterTrackedViews([options])](#View+unregisterTrackedViews) ⇒ [View
](#View)
* [.transitionOut(done, options)](#View+transitionOut)
* [.transitionIn(attach, done, options)](#View+transitionIn)
* [.invokeFeedback(to, [evt], [indexMap])](#View+invokeFeedback)
### new constructor()
### view.viewState : [ViewStateCell
](#ViewStateCell)
View
](#View)
### view.get()
View
](#View)
### view.set()
View
](#View)
### view.has()
View
](#View)
### view.unset()
View
](#View)
### view.toJSON()
View
](#View)
### view.getBehavior(alias) ⇒ Torso.Behavior
**Kind**: instance method of [View
](#View)
**Returns**: Torso.Behavior
- string
| Object
See __getPrepareFieldsContext() for more details on how to configure them.View
](#View)
**Returns**: Object
-
{view: this.viewState.toJSON(), model: this.model.toJSON()}Object
View
](#View)
**Returns**: Object
- Promise
Defaults to using this.templateRender. Assumes that this.template is a javascript
function that accepted a single JSON context.
The render method returns a promise that resolves when rendering is complete. Typically render
is synchronous and the rendering is complete upon completion of the method. However, when utilizing
transitions/animations, the render process can be asynchronous and the promise is useful to know when it has finished.View
](#View)
**Returns**: Promise
- Promise
\| Array.<Promise>
This method can be overwritten as usual OR extended using
NOTE: if you require the view to be detached from the DOM, consider using _detach callback</p>
**Kind**: instance method of [View
](#View)
**Returns**: Promise
\| Array.<Promise>
-
Defaults to using the stanrdard: this.templateRender(this.$el, this.template, this.prepare(), templateRendererOptions);
this.templateRendererOptions is an object or function defined on the view that is passed into the renderer.
Examples include: views with no template or multiple templates, or if you wish to use a different rendering engine than the templateRenderer or wish to pass options to it.View
](#View)
### view.updateClassName(newClassName)
If no value provided, removes the class attribute of this view element.View
](#View)
| Param | Type | Description |
| --- | --- | --- |
| newClassName | string
| Promise
\| Array.<Promise>
This method can be overwritten as usual OR extended using
NOTE: if you require the view to be attached to the DOM, consider using _attach callback</p>
**Kind**: instance method of [View
](#View)
**Returns**: Promise
\| Array.<Promise>
-
See Torso.templateRenderer#render for paramsView
](#View)
### view.delegateEvents()
Binds DOM events with the view using events hash while also adding feedback event bindingsView
](#View)
### view.undelegateEvents()
Unbinds DOM events from the view.View
](#View)
### view.attachTo([$el], [options]) ⇒ Promise
View
](#View)
**Returns**: Promise
-
make it asynchronous.jQuery
](#external_jQuery) | |
If options.replaceMethod is provided, then this parameter is ignored.Object
| | Fucntion
| |
in order to attach the view's DOM to the parent instead of calling $el.replaceWithBooleon
| false
| Promise
The element argument can be a String that references an element with the corresponding "inject" attribute.
When using attachView with options.useTransition:
Will inject a new view into an injection site by using the new view's transitionIn method. If the parent view
previously had another view at this injections site, this previous view will be removed with that view's transitionOut.
If this method is used within a render, the current views' injection sites will be cached so they can be transitioned out even
though they are detached in the process of re-rendering. If no previous view is given and none can be found, the new view is transitioned in regardless.
If the previous view is the same as the new view, it is injected normally without transitioning in.
The previous view must has used an injection site with the standard "inject=
When the transitionIn and transitionOut methods are invoked on the new and previous views, the options parameter will be passed on to them. Other fields
will be added to the options parameter to allow better handling of the transitions. These include:
{
newView: the new view
previousView: the previous view (can be undefined)
parentView: the parent view transitioning in or out the tracked view
}</p>
**Kind**: instance method of [View
](#View)
**Returns**: Promise
- jQuery
](#external_jQuery) \| string
| | View
](#View) | | Object
| | boolean
| false
| boolean
| false
| boolean
| false
| boolean
| false
| View
](#View) | |
If using transitions and no previousView is provided, it will look to see if a view already is at this injection site and uses that by default.Promise
\| Array.<Promise>
This method can be overwritten as usual OR extended using View
](#View)
**Returns**: Promise
\| Array.<Promise>
-
after the DOM has been attached to the document. The default implementation is a no-op.View
](#View)
### view.isAttachedToParent() ⇒ boolean
**Kind**: instance method of [View
](#View)
**Returns**: boolean
- boolean
View
](#View)
**Returns**: boolean
-
This method will only separate this view from the DOM it was attached to, but it WILL invoke the _detach
callback on each tracked view recursively.View
](#View)
### view.detachTrackedViews([options])
NOTE: this is not recursive - it will not separate the entire view tree.View
](#View)
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [options] | Object
| {}
| boolean
| false
|
which are disposed when the parent is disposed.boolean
| false
|
after the view has been removed from the document. The default implementation is a no-op.View
](#View)
### view.activate()
View
](#View)
### view.\_activate()
custom timers, listenTo's or on's that should be activatable. The default implementation is a no-op.View
](#View)
### view.isActive() ⇒ boolean
**Kind**: instance method of [View
](#View)
**Returns**: boolean
-
and events that may affect user experience. Recursively invokes deactivate on child viewsView
](#View)
### view.\_deactivate()
custom timers, listenTo's or on's that should be deactivatable. The default implementation is a no-op.View
](#View)
### view.dispose()
After dispose is called, the view can be safely garbage collected. Called while
recursively removing views from the hierarchy.View
](#View)
### view.\_dispose()
view's element, its on's, listenTo's, and any registered children.
Override this method to destruct any extraView
](#View)
### view.isDisposed() ⇒ boolean
**Kind**: instance method of [View
](#View)
**Returns**: boolean
- boolean
**Kind**: instance method of [View
](#View)
**Returns**: boolean
- Object
| {}
| boolean
| false
|
which are disposed when the parent is disposed.boolean
| false
| List.<View>
](#View)
View
](#View)
**Returns**: [List.<View>
](#View) - Object
| {}
| boolean
| false
|
which are disposed when the parent is disposed.boolean
| false
| View
](#View)
**Returns**: string
| View
](#View)
be done to the tracked view as well. Except dispose for shared views. This method defaults to register the
view as a child view unless specified by options.shared.View
](#View)
**Returns**: [View
](#View) - View
](#View) | | Object
| {}
| boolean
| false
|
which are disposed when the parent is disposed. If false, registers view as a child view which are disposed when the parent is disposed.View
](#View)
View
](#View)
**Returns**: [View
](#View) - View
](#View) | View
](#View)
You can limit the types of views that will be unregistered by using the options parameter.View
](#View)
**Returns**: [View
](#View) - Object
| {}
| boolean
| false
|
which are disposed when the parent is disposed.boolean
| false
|
The method is passed a callback that should be invoked when the transition out has fully completed.View
](#View)
| Param | Type | Description |
| --- | --- | --- |
| done | function
| View
](#View) | View
](#View) | View
](#View) |
The method is passed a callback that should be invoked when the transition in has fully completed.View
](#View)
| Param | Type | Description |
| --- | --- | --- |
| attach | function
|
If you are trying to transition in a tracked view, consider using this.transitionInView()function
| View
](#View) | View
](#View) | View
](#View) | View
](#View)
| Param | Type | Description |
| --- | --- | --- |
| to | string
| Event
| Object
| Backbone-History
](#external_Backbone-History)
**Kind**: global class
**Extends**: [Backbone-History
](#external_Backbone-History)
**See**: history Annotated Source
**Author**: kent.willis@vecna.com
### new history()
Backbone-Events
](#external_Backbone-Events)
**Kind**: global class
**Extends**: [Backbone-Events
](#external_Backbone-Events)
**See**: registry Annotated Source
**Author**: jyoung@vecna.com
* [registry](#registry) ⇐ [Backbone-Events
](#external_Backbone-Events)
* [new registry()](#new_registry_new)
* [.cells](#registry+cells) : Object.<string, Cell>
* [.models](#registry+models) : Object.<string, Model>
* [.services](#registry+services) : Object.<string, ServiceCell>
* [.views](#registry+views) : Object.<string, View>
* [.cidPrefix](#registry+cidPrefix) : string
* [.modelInitialized(model)](#registry+modelInitialized)
* [.cellInitialized(cell)](#registry+cellInitialized)
* [.viewInitialized(view)](#registry+viewInitialized)
* [.serviceInitialized(service)](#registry+serviceInitialized)
* [.disposeAll()](#registry+disposeAll)
* [.disposeAllModels()](#registry+disposeAllModels)
* [.disposeAllCells()](#registry+disposeAllCells)
* [.disposeAllServices()](#registry+disposeAllServices)
* [.disposeAllViews()](#registry+disposeAllViews)
### new registry()
Object.<string, Cell>
registry
](#registry)
### registry.models : Object.<string, Model>
registry
](#registry)
### registry.services : Object.<string, ServiceCell>
registry
](#registry)
### registry.views : Object.<string, View>
registry
](#registry)
### registry.cidPrefix : string
registry
](#registry)
### registry.modelInitialized(model)
registry
](#registry)
| Param | Type | Description |
| --- | --- | --- |
| model | Torso.Model
| registry
](#registry)
| Param | Type | Description |
| --- | --- | --- |
| cell | Torso.Cell
| registry
](#registry)
| Param | Type | Description |
| --- | --- | --- |
| view | Torso.View
| registry
](#registry)
| Param | Type | Description |
| --- | --- | --- |
| service | Torso.ServiceCell
| registry
](#registry)
### registry.disposeAllModels()
registry
](#registry)
### registry.disposeAllCells()
registry
](#registry)
### registry.disposeAllServices()
registry
](#registry)
### registry.disposeAllViews()
registry
](#registry)
## DataBehavior ⇐ [Behavior
](#Behavior)
**Kind**: global class
**Extends**: [Behavior
](#Behavior)
**See**
- DataBehavior Annotated Source
- Detailed docs for more in-depth documentation and details.
**Author**: jyoung@vecna.com
* [DataBehavior](#DataBehavior) ⇐ [Behavior
](#Behavior)
* [new DataBehavior()](#new_DataBehavior_new)
* _instance_
* [.alias](#Behavior+alias) : string
* [.cidPrefix](#Behavior+cidPrefix) : string
* [.mixin](#Behavior+mixin) : Object
* [.prepare()](#Behavior+prepare) ⇒ Object
* [._dispose()](#Behavior+_dispose)
* [.isDisposed()](#Behavior+isDisposed) ⇒ boolean
* _static_
* [.cache](#DataBehavior.cache)
* [.renderOnFetch](#DataBehavior.renderOnFetch)
* [.skipInitialLoad](#DataBehavior.skipInitialLoad)
* [.returnSingleResult](#DataBehavior.returnSingleResult)
* [.alwaysFetch](#DataBehavior.alwaysFetch)
* [.ids](#DataBehavior.ids)
* [.updateEvents](#DataBehavior.updateEvents)
* [.data](#DataBehavior.data)
* [.FETCHED_STATUSES](#DataBehavior.FETCHED_STATUSES)
* [.constructor([behaviorState], behaviorOptions, [viewOptions])](#DataBehavior.constructor)
* [.retrieve()](#DataBehavior.retrieve) ⇒ $.Deferred.Promise
* [.pull()](#DataBehavior.pull) ⇒ $.Deferred.Promise
* [.fetch()](#DataBehavior.fetch) ⇒ $.Deferred.Promise
* [.prepare()](#DataBehavior.prepare)
* [.isLoading()](#DataBehavior.isLoading) ⇒ boolean
* [.isLoadingIds()](#DataBehavior.isLoadingIds) ⇒ boolean
* [.isLoadingObjects()](#DataBehavior.isLoadingObjects) ⇒ boolean
* [.listenToIdsPropertyChangeEvent()](#DataBehavior.listenToIdsPropertyChangeEvent)
* [.stopListeningToIdsPropertyChangeEvent()](#DataBehavior.stopListeningToIdsPropertyChangeEvent)
* [.retrieveOncePromise()](#DataBehavior.retrieveOncePromise) ⇒ [jQuery-Deferred
](#external_jQuery-Deferred)
* _inner_
* [~Data](#DataBehavior..Data)
* [new Data()](#new_DataBehavior..Data_new)
### new DataBehavior()
This behavior manages re-rendering when data changes and automatically adding the returned data to the view's context.
This behavior also manages dependencies between data and other objects to allow intelligent re-fetching when data changes.string
DataBehavior
](#DataBehavior)
### dataBehavior.cidPrefix : string
DataBehavior
](#DataBehavior)
### dataBehavior.mixin : Object
DataBehavior
](#DataBehavior)
### dataBehavior.prepare() ⇒ Object
effectively: { [behaviorName]: behavior.prepare() } will be combined with the view's prepare result.DataBehavior
](#DataBehavior)
**Returns**: Object
-
behavior's on's and listenTo's.
Override this method to destruct any extraDataBehavior
](#DataBehavior)
### dataBehavior.isDisposed() ⇒ boolean
**Kind**: instance method of [DataBehavior
](#DataBehavior)
**Returns**: boolean
-
This property/option is required. Instantiation will fail if it is not set.DataBehavior
](#DataBehavior)
**Properties**
| Name | Type |
| --- | --- |
| cache | [Collection
](#Collection) |
### DataBehavior.renderOnFetch
fetched
event that triggers a render on the view.
true - A listener is added to the behavior that re-renders the view when a 'fetched' event is triggered.
false (default) - no listeners are added.DataBehavior
](#DataBehavior)
**Default**: false
**Properties**
| Name | Type |
| --- | --- |
| renderOnFetch | boolean
|
### DataBehavior.skipInitialLoad
true - no load after the view is initialized.
false (default) - trigger a .retrieve() on this data behavior when the view completes initialization.DataBehavior
](#DataBehavior)
**Default**: false
**Properties**
| Name | Type |
| --- | --- |
| skipInitialLoad | boolean
|
### DataBehavior.returnSingleResult
view.getBehavior('thisBehaviorAlias').toJSON()
.
true - a single model result is returned.
false (default) - an array of model results are returned.DataBehavior
](#DataBehavior)
**Default**: false
**Properties**
| Name | Type |
| --- | --- |
| returnSingleResult | boolean
|
### DataBehavior.alwaysFetch
pull()
or fetch()
is called when using retrieve()
.
true - Use fetch() by default on the private collection.
false (default) - Use pull() by default on the private collection.
True will query the server more often, but will provide more up-to-date data.
False will only query the server if the model hasn't already been retrieved.
This property will be ignored if fetch()
or pull()
is called directly.DataBehavior
](#DataBehavior)
**Default**: false
**Properties**
| Name | Type |
| --- | --- |
| alwaysFetch | boolean
|
### DataBehavior.ids
property on that object to use. The object can fire the change event for the given property
and have a .get('propertyName') method, or it can define the property directly on the idContainer.
Only one property can be identified as supplying the id for this data model.
If the identified object does not fire a change event then the id(s) will never be refreshed for this behavior.
The idContainer can also fire a 'fetched:ids' event on itself to signal to this data behavior that the ids
have been fetched for the first time. Then a 'change:
data behavior that the property has been modified.</p>
idContainer is defined. The idContainer is the object that fires a change event for the given property name.
Uses the view or the idContainer as the root to get the identified property (i.e. 'viewState.', 'model.', etc).
Will get the property before the first '.' from the view and if it is an object will try to use a
.get('
If it is a string/number or array of string/number, then it will use that as the ids.
Triggering a 'id-container-updated' event on the behavior will cause it to stop listing to the
old idContainer and start listening to the new one defined by this property.</li>
events and has a .get('propertyName') function. It isn't required to fire events -
the change event is only required if it needs to re-fetch when the id property value changes.
Examples:
to track with the private collection. Cache is passed in as the first argument so that the behavior
can be defined and the cache can be overridden later.
'this' is the behavior (from which you can get the view if needed).
What was criteria should use this instead:function(cache) {
var thisBehaviorInstance = this;
var view = this.view;
var criteria = { ... some criteria ... };
return cache.fetchIdsByCriteria(criteria);
}
DataBehavior
](#DataBehavior)
**Properties**
| Name | Type |
| --- | --- |
| ids | string
\| number
\| Array.<string>
\| Array.<number>
\| Object
\| function
|
### DataBehavior.updateEvents
(space separated if string, single item is equivalent to array of single item).
DataBehavior
](#DataBehavior)
**Properties**
| Name | Type |
| --- | --- |
| updateEvents | string
\| Array.<string>
\| Object
\| Array.<Object>
|
### DataBehavior.data
and has get('...') and .toJSON() methods that access the private collection data.DataBehavior
](#DataBehavior)
**Properties**
| Name | Type |
| --- | --- |
| data | Torso.behaviors.DataBehavior.Data
|
### DataBehavior.FETCHED\_STATUSES
DataBehavior
](#DataBehavior)
**Properties**
| Name | Type | Description |
| --- | --- | --- |
| { | Object
| DataBehavior
](#DataBehavior)
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [behaviorState] | Object
| | Object
| | |
| behaviorOptions.cache | [Collection
](#Collection) | | boolean
| false
| boolean
| false
| boolean
| false
| boolean
| false
| string
\| number
\| Array.<string>
\| Array.<number>
\| Object
\| function
| "behaviorOptions.ids"
| string
\| number
\| Array.<string>
\| Array.<number>
\| Object
\| function
| "behaviorOptions.id"
| string
\| Array.<string>
\| Object
\| Array.<Object>
| | Object
| | $.Deferred.Promise
pull or a fetch based on the alwaysFetch property. (pull is default if always fetch is true then it fetches instead).DataBehavior
](#DataBehavior)
**Returns**: $.Deferred.Promise
- $.Deferred.Promise
DataBehavior
](#DataBehavior)
**Returns**: $.Deferred.Promise
- $.Deferred.Promise
DataBehavior
](#DataBehavior)
**Returns**: $.Deferred.Promise
- DataBehavior
](#DataBehavior)
### DataBehavior.isLoading() ⇒ boolean
DataBehavior
](#DataBehavior)
**Returns**: boolean
-
false - the behavior is not currently loading objects or ids.boolean
DataBehavior
](#DataBehavior)
**Returns**: boolean
-
false - the behavior is not currently loading ids.boolean
DataBehavior
](#DataBehavior)
**Returns**: boolean
-
false - the behavior is not currently loading objects.DataBehavior
](#DataBehavior)
### DataBehavior.stopListeningToIdsPropertyChangeEvent()
DataBehavior
](#DataBehavior)
### DataBehavior.retrieveOncePromise() ⇒ [jQuery-Deferred
](#external_jQuery-Deferred)
This is especially useful if you don't care if the fetch has already happen you just want to do something once
the data is loaded.
before you start listening. This gives a structure for handling that case so that your methods are called
if the event is fired and if it is not fired.
resolve/reject handlers.
.then(view.doSomethingWithTheData, view.handleFiledFetch);DataBehavior
](#DataBehavior)
**Returns**: [jQuery-Deferred
](#external_jQuery-Deferred) - DataBehavior
](#DataBehavior)
#### new Data()
Collection
](#Collection)
**Kind**: global class
**Extends**: [Collection
](#Collection)
* [PrivateCollection](#PrivateCollection) ⇐ [Collection
](#Collection)
* [new PrivateCollection(parent, guid)](#new_PrivateCollection_new)
* [.pollTimeoutId](#Collection+pollTimeoutId)
* [.getTrackedIds()](#PrivateCollection+getTrackedIds) ⇒ Array
* [.fetch([options])](#PrivateCollection+fetch) ⇒ Promise
* [.fetchByIds(ids, [options])](#PrivateCollection+fetchByIds) ⇒ Promise
* [.trackIds(ids)](#PrivateCollection+trackIds)
* [.addModelAndTrack(model)](#PrivateCollection+addModelAndTrack)
* [.trackNewId(id)](#PrivateCollection+trackNewId)
* [.trackAndFetch()](#PrivateCollection+trackAndFetch) ⇒
* [.pull([options])](#PrivateCollection+pull) ⇒ Promise
* [.trackAndPull()](#PrivateCollection+trackAndPull) ⇒
* [.requesterDispose()](#PrivateCollection+requesterDispose)
* [.remove(modelIdentifier)](#PrivateCollection+remove)
* [.filterDefault()](#Collection+filterDefault) ⇒ [Collection
](#Collection)
* [.dispose()](#Collection+dispose)
* [.isPolling()](#Collection+isPolling)
* [.startPolling(pollInterval)](#Collection+startPolling)
* [.stopPolling()](#Collection+stopPolling)
* [.polledFetch()](#Collection+polledFetch)
* [.constructor(args)](#Collection+constructor)
* [.hasLoadedOnce()](#Collection+hasLoadedOnce) ⇒ boolean
* [.isLoading()](#Collection+isLoading) ⇒ boolean
* [.getLoadedOncePromise()](#Collection+getLoadedOncePromise) ⇒ Promise
* [.getRequesterIds(the)](#Collection+getRequesterIds) ⇒ Array
* [.getRequesterIdsAsDictionary(guid)](#Collection+getRequesterIdsAsDictionary) ⇒ Object
* [.removeRequester(guid)](#Collection+removeRequester)
* [.getRequesters()](#Collection+getRequesters) ⇒ Array
* [.getAllRequestedIds()](#Collection+getAllRequestedIds) ⇒ Array
* [.createPrivateCollection(guid)](#Collection+createPrivateCollection) ⇒ [PrivateCollection
](#PrivateCollection)
* [.registerIds(newIds, guid)](#Collection+registerIds)
### new PrivateCollection(parent, guid)
and adds a requesterMixin that connects this cache to it's parentBackbone-Collection
](#external_Backbone-Collection) | string
| PrivateCollection
](#PrivateCollection)
**Mixes**: [pollTimeoutId
](#pollingMixin.pollTimeoutId)
**Properties**
| Name | Type | Description |
| --- | --- | --- |
| pollTimeoutId | number
| Array
**Kind**: instance method of [PrivateCollection
](#PrivateCollection)
**Returns**: Array
- Promise
PrivateCollection
](#PrivateCollection)
**Overrides**: [fetch
](#Collection+fetch)
**Returns**: Promise
- Array
| collectionTrackedIds
| Object
| | Promise
PrivateCollection
](#PrivateCollection)
**Overrides**: [fetchByIds
](#Collection+fetchByIds)
**Returns**: Promise
- Array
| Object
|
Overrides the Id registration system to route via the parent collectionPrivateCollection
](#PrivateCollection)
| Param | Description |
| --- | --- |
| ids | PrivateCollection
](#PrivateCollection)
| Param | Type | Description |
| --- | --- | --- |
| model | [Backbone-Model
](#external_Backbone-Model) | PrivateCollection
](#PrivateCollection)
| Param | Type | Description |
| --- | --- | --- |
| id | string
\| Number
|
This will reset any previous list of ids being tracked.PrivateCollection
](#PrivateCollection)
**Returns**: Promise
while not fetching models that are already in the cache. Useful when you want the effeciency of
pulling models from the cache and don't need all the models to be up-to-date.
The promise will resolve to a unified data property that is a combination of the completion of all of the fetches.PrivateCollection
](#PrivateCollection)
**Returns**: Promise
-
Will only resolve once all ids have attempted to be fetched from the server.Object
|
the difference between pull and fetch.PrivateCollection
](#PrivateCollection)
**Returns**: PrivateCollection
](#PrivateCollection)
### privateCollection.remove(modelIdentifier)
PrivateCollection
](#PrivateCollection)
| Param | Type | Description |
| --- | --- | --- |
| modelIdentifier | \*
|
by id, cid, model object with id or cid properties,
or an attributes object that is transformed through modelIdCollection
](#Collection)
PrivateCollection
](#PrivateCollection)
**Returns**: [Collection
](#Collection) -
to this collection.PrivateCollection
](#PrivateCollection)
### privateCollection.isPolling()
PrivateCollection
](#PrivateCollection)
**Mixes**: [isPolling
](#pollingMixin.isPolling)
### privateCollection.startPolling(pollInterval)
Note: Each Model/Collection will only allow a singleton of polling to occur so
as not to have duplicate threads updating Model/Collection.PrivateCollection
](#PrivateCollection)
**Mixes**: [startPolling
](#pollingMixin.startPolling)
| Param | Type | Description |
| --- | --- | --- |
| pollInterval | Integer
| PrivateCollection
](#PrivateCollection)
**Mixes**: [stopPolling
](#pollingMixin.stopPolling)
### privateCollection.polledFetch()
to backbone's fetch all.PrivateCollection
](#PrivateCollection)
**Mixes**: [polledFetch
](#pollingMixin.polledFetch)
### privateCollection.constructor(args)
PrivateCollection
](#PrivateCollection)
**Mixes**: [constructor
](#loadingMixin.constructor)
**Overrides**: [constructor
](#Collection+constructor)
| Param | Type | Description |
| --- | --- | --- |
| args | Object
| boolean
**Kind**: instance method of [PrivateCollection
](#PrivateCollection)
**Mixes**: [hasLoadedOnce
](#loadingMixin.hasLoadedOnce)
**Returns**: boolean
- boolean
**Kind**: instance method of [PrivateCollection
](#PrivateCollection)
**Mixes**: [isLoading
](#loadingMixin.isLoading)
**Returns**: boolean
- Promise
**Kind**: instance method of [PrivateCollection
](#PrivateCollection)
**Mixes**: [getLoadedOncePromise
](#loadingMixin.getLoadedOncePromise)
**Returns**: Promise
- Array
**Kind**: instance method of [PrivateCollection
](#PrivateCollection)
**Mixes**: [getRequesterIds
](#cacheMixin.getRequesterIds)
**Returns**: Array
- string
| Object
PrivateCollection
](#PrivateCollection)
**Mixes**: [getRequesterIdsAsDictionary
](#cacheMixin.getRequesterIdsAsDictionary)
**Returns**: Object
- string
| PrivateCollection
](#PrivateCollection)
**Mixes**: [removeRequester
](#cacheMixin.removeRequester)
| Param | Type | Description |
| --- | --- | --- |
| guid | string
| Array
TODO: should this return just the knownPrivateCollectionsPrivateCollection
](#PrivateCollection)
**Mixes**: [getRequesters
](#cacheMixin.getRequesters)
**Returns**: Array
- Array
PrivateCollection
](#PrivateCollection)
**Mixes**: [getAllRequestedIds
](#cacheMixin.getAllRequestedIds)
**Returns**: Array
- PrivateCollection
](#PrivateCollection)
Binds a custom "resized" event to the private collections.
Overrides the fetch method to call the parent collection's fetchByIds method.
Overrides the registerIds method to redirect to its parent collection.PrivateCollection
](#PrivateCollection)
**Mixes**: [createPrivateCollection
](#cacheMixin.createPrivateCollection)
**Returns**: [PrivateCollection
](#PrivateCollection) - string
|
any cached models its way.
requests for Ids to be fetched. Furthermore, the "polledFetch" method
is overriden such that it no longer routes through Backbone's fetch all,
but rather a custom "fetchByIds" method.PrivateCollection
](#PrivateCollection)
**Mixes**: [registerIds
](#cacheMixin.registerIds)
| Param | Type | Description |
| --- | --- | --- |
| newIds | Array
| string
| undefined
\| string
\| Object
* [.isValid()](#validationMixin.isValid)
* [.validate()](#validationMixin.validate)
### validationMixin.preValidate(attr, [value]) ⇒ undefined
\| string
\| Object
you can pass in different values to use in the validation process instead.validationMixin
](#validationMixin)
**Returns**: undefined
\| string
\| Object
-
and the error as the valuestring
\| Object
\| Array.<string>
|
on object with attribute name to valuesAny
|
entire model is valid. Passing true will force a validation
of the model.validationMixin
](#validationMixin)
### validationMixin.validate()
You can call it manually without any parameters to validate the
entire model.validationMixin
](#validationMixin)
## cacheMixin
**Kind**: global mixin
**See**: cacheMixin Annotated Source
**Author**: ariel.wexler@vecna.com, kent.willis@vecna.com
* [cacheMixin](#cacheMixin)
* [.getRequesterIds(the)](#cacheMixin.getRequesterIds) ⇒ Array
* [.getRequesterIdsAsDictionary(guid)](#cacheMixin.getRequesterIdsAsDictionary) ⇒ Object
* [.removeRequester(guid)](#cacheMixin.removeRequester)
* [.getRequesters()](#cacheMixin.getRequesters) ⇒ Array
* [.getAllRequestedIds()](#cacheMixin.getAllRequestedIds) ⇒ Array
* [.createPrivateCollection(guid)](#cacheMixin.createPrivateCollection) ⇒ [PrivateCollection
](#PrivateCollection)
* [.registerIds(newIds, guid)](#cacheMixin.registerIds)
* [.fetch(options)](#cacheMixin.fetch)
* [.fetchByIds([fetchByIdsOptions])](#cacheMixin.fetchByIds) ⇒ Promise
* [.constructor([options])](#cacheMixin.constructor)
### cacheMixin.getRequesterIds(the) ⇒ Array
**Kind**: static method of [cacheMixin
](#cacheMixin)
**Returns**: Array
- string
| Object
cacheMixin
](#cacheMixin)
**Returns**: Object
- string
| cacheMixin
](#cacheMixin)
| Param | Type | Description |
| --- | --- | --- |
| guid | string
| Array
TODO: should this return just the knownPrivateCollectionscacheMixin
](#cacheMixin)
**Returns**: Array
- Array
cacheMixin
](#cacheMixin)
**Returns**: Array
- PrivateCollection
](#PrivateCollection)
Binds a custom "resized" event to the private collections.
Overrides the fetch method to call the parent collection's fetchByIds method.
Overrides the registerIds method to redirect to its parent collection.cacheMixin
](#cacheMixin)
**Returns**: [PrivateCollection
](#PrivateCollection) - string
|
any cached models its way.
requests for Ids to be fetched. Furthermore, the "polledFetch" method
is overriden such that it no longer routes through Backbone's fetch all,
but rather a custom "fetchByIds" method.cacheMixin
](#cacheMixin)
| Param | Type | Description |
| --- | --- | --- |
| newIds | Array
| string
|
Calling fetch from the cache will fetch the tracked ids if fetchUsingTrackedIds is set to true, otherwise
it will pass through to the default fetch.cacheMixin
](#cacheMixin)
| Param | Type |
| --- | --- |
| options | Object
|
### cacheMixin.fetchByIds([fetchByIdsOptions]) ⇒ Promise
cacheMixin
](#cacheMixin)
**Returns**: Promise
- Array
| collection.collectionTrackedIds
| Object
| |
Allocate new memory for the local references if they
were null when this method was called.cacheMixin
](#cacheMixin)
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [options] | Object
| | string
| "'POST'"
| string
| "'/ids'"
| boolean
| true
|
but will rather call the default fetch method.
If true, the cell will not fail is persisted functions are invoked
If false, the cell will throw exceptions if persisted function are invokedcellMixin
](#cellMixin)
**Default**: false
**Properties**
| Name | Type |
| --- | --- |
| isModelCompatible | boolean
|
### cellMixin.save()
cellMixin
](#cellMixin)
### cellMixin.fetch()
cellMixin
](#cellMixin)
### cellMixin.sync()
cellMixin
](#cellMixin)
### cellMixin.url()
cellMixin
](#cellMixin)
## loadingMixin
boolean
* [.isLoading()](#loadingMixin.isLoading) ⇒ boolean
* [.getLoadedOncePromise()](#loadingMixin.getLoadedOncePromise) ⇒ Promise
* [.fetch(options)](#loadingMixin.fetch) ⇒ Promise
### loadingMixin.constructor(args)
loadingMixin
](#loadingMixin)
| Param | Type | Description |
| --- | --- | --- |
| args | Object
| boolean
**Kind**: static method of [loadingMixin
](#loadingMixin)
**Returns**: boolean
- boolean
**Kind**: static method of [loadingMixin
](#loadingMixin)
**Returns**: boolean
- Promise
**Kind**: static method of [loadingMixin
](#loadingMixin)
**Returns**: Promise
- Promise
loadingMixin
](#loadingMixin)
**Returns**: Promise
- Object
|
Removes listeners and calls out to _dispose() for child specific dispose logic.
Triggers 2 events - "before-dispose" and "after-dispose".modelMixin
](#modelMixin)
### modelMixin.\_dispose()
modelMixin
](#modelMixin)
## pollingMixin
part of any collections. It should not be used for a model that is a part of a collection.pollingMixin
](#pollingMixin)
**Properties**
| Name | Type | Description |
| --- | --- | --- |
| pollTimeoutId | number
| pollingMixin
](#pollingMixin)
### pollingMixin.startPolling(pollInterval)
Note: Each Model/Collection will only allow a singleton of polling to occur so
as not to have duplicate threads updating Model/Collection.pollingMixin
](#pollingMixin)
| Param | Type | Description |
| --- | --- | --- |
| pollInterval | Integer
| pollingMixin
](#pollingMixin)
### pollingMixin.polledFetch()
to backbone's fetch all.pollingMixin
](#pollingMixin)
## HandlebarsHelper : object
**Kind**: global namespace
* [HandlebarsHelper](#HandlebarsHelper) : object
* [.labelFor(field, options)](#HandlebarsHelper.labelFor) ⇒ string
* [.bindModel(field, options)](#HandlebarsHelper.bindModel) ⇒ string
* [.feedback(field, options)](#HandlebarsHelper.feedback) ⇒ string
* [.formAttr(field, options)](#HandlebarsHelper.formAttr) ⇒ string
* [.dasherize(str)](#HandlebarsHelper.dasherize) ⇒ string
* [.injectFieldIndices(field, indexMap, options)](#HandlebarsHelper.injectFieldIndices) ⇒ string
### HandlebarsHelper.labelFor(field, options) ⇒ string
HandlebarsHelper
](#HandlebarsHelper)
**Returns**: string
- string
| Object
| string
| string
id="field-name-123_sub-demo" value="demo"
id="field-name_abc_sub-demo" value="demo"HandlebarsHelper
](#HandlebarsHelper)
**Returns**: string
- string
| Object
| string
| string
HandlebarsHelper
](#HandlebarsHelper)
**Returns**: string
- string
| Object
| string
HandlebarsHelper
](#HandlebarsHelper)
**Returns**: string
- string
| Object
| string
| boolean
|
then it will not generate the "value" attribute in the DOM.string
HandlebarsHelper
](#HandlebarsHelper)
**Returns**: string
- string
| string
HandlebarsHelper
](#HandlebarsHelper)
**Returns**: string
- string
| | Object
| | Object
| | boolean
| false
| object
All template renders should be piped through this method.object
* [.hotswap(currentNode, newNode, ignoreElements)](#templateRenderer.hotswap)
* [.render($el, template, context, [opts])](#templateRenderer.render)
* [.hotswapKeepCaret(currentNode, newNode, ignoreElements)](#templateRenderer.hotswapKeepCaret)
* [.copyTopElement(el)](#templateRenderer.copyTopElement) ⇒ Element
* [.supportsSelection(el)](#templateRenderer.supportsSelection) ⇒ boolean
* [.getCaretPosition(elem)](#templateRenderer.getCaretPosition) ⇒ Integer
* [.setCaretPosition(elem, caretPos)](#templateRenderer.setCaretPosition) ⇒ Integer
### templateRenderer.hotswap(currentNode, newNode, ignoreElements)
Delegates to a particular swapMethod, depending on the Node type.
Recurses for nested Element Nodes only.
There is always room for optimizing this method.templateRenderer
](#templateRenderer)
| Param | Type | Description |
| --- | --- | --- |
| currentNode | Node
| Node
| Array
| templateRenderer
](#templateRenderer)
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| $el | [jQuery
](#external_jQuery) | | Handlebars-Template
](#external_Handlebars-Template) | | Object
| | Object
| | boolean
| false
| string
| | Array
| | templateRenderer
](#templateRenderer)
| Param | Type | Description |
| --- | --- | --- |
| currentNode | Node
| Node
| Array
| Element
templateRenderer
](#templateRenderer)
**Returns**: Element
- Element
| boolean
selection is only allowed for text, search, tel, url, password. Other input types will throw an exception in chrometemplateRenderer
](#templateRenderer)
**Returns**: boolean
- Element
| Integer
Source: http://stackoverflow.com/questions/2897155/get-cursor-position-in-characters-within-a-text-input-fieldtemplateRenderer
](#templateRenderer)
**Returns**: Integer
- element
| Integer
Source: http://stackoverflow.com/questions/512528/set-cursor-position-in-html-textboxtemplateRenderer
](#templateRenderer)
**Returns**: Integer
- element
| |
| caretPos | Integer
| object
Behavior
](#Behavior) | Object
| DataBehavior
](#DataBehavior) | Cell
](#Cell) | Collection
](#Collection) | Events
](#Events) | Object
| loadingMixin
](#loadingMixin) | cacheMixin
](#cacheMixin) | pollingMixin
](#pollingMixin) | mixin
](#Validation.mixin) | cellMixin
](#cellMixin) | Model
](#Model) | NestedCell
](#NestedCell) | NestedModel
](#NestedModel) | FormModel
](#FormModel) | ServiceCell
](#ServiceCell) | Router
](#Router) | history
](#history) | registry
](#registry) | Object
| templateRenderer
](#templateRenderer) | handlebarsUtils
](#handlebarsUtils) | Validation
](#Validation) | View
](#View) | ListView
](#ListView) | FormView
](#FormView) | object
object
* [.version](#Validation.version) : string
* [.mixin](#Validation.mixin) : [validationMixin
](#validationMixin)
* [.configure(options)](#Validation.configure)
### Validation.version : string
Validation
](#Validation)
### Validation.mixin : [validationMixin
](#validationMixin)
Validation
](#Validation)
### Validation.configure(options)
Validation
](#Validation)
| Param |
| --- |
| options |
## handlebarsUtils(Handlebars)
Handlebars
](#external_Handlebars) | Backbone-Events
](#external_Backbone-Events)
Backbone-Events
](#external_Backbone-Events)
**See**: [Backbone.Collection](http://backbonejs.org/#Collection)
## Backbone-Events
Backbone-Events
](#external_Backbone-Events)
Backbone-Events
](#external_Backbone-Events)
**See**: [Backbone.Model](http://backbonejs.org/#Model)
## Backbone-NestedModel ⇐ [Backbone-Model
](#external_Backbone-Model)
Backbone-Model
](#external_Backbone-Model)
**See**: [backbone-nested](https://github.com/afeld/backbone-nested)
## Backbone-Router ⇐ [Backbone-Events
](#external_Backbone-Events)
Backbone-Events
](#external_Backbone-Events)
**See**: [Backbone.Router](http://backbonejs.org/#Router)
## Backbone-View ⇐ [Backbone-Events
](#external_Backbone-Events)
Backbone-Events
](#external_Backbone-Events)
**See**: [Backbone.View](http://backbonejs.org/#View)
## Handlebars
Backbone-Events
](#external_Backbone-Events)
Backbone-Events
](#external_Backbone-Events)
**See**: [Backbone.History](http://backbonejs.org/#History)
## jQuery
jQuery-Deferred
](#external_jQuery-Deferred) |
## jQuery-Deferred
Backbone-Events
](#external_Backbone-Events) |
| View | [Backbone-View
](#external_Backbone-View) |
| Model | [Backbone-Model
](#external_Backbone-Model) |
| Collection | [Backbone-Collection
](#external_Backbone-Collection) |