API - AbstractModel

Extends ObjectManager

This is an abstract model, used when using a model without table, or creating your own model. This will create the states and set some predefined states which can be used at will.

Methods

This function will be available for every object, this will clone the current object.

Returns Object: An exact copy of the current object

This is a private function to allow for config extending This method takes two parameters the first is the original config and the second will be appeneded to this one.

Parameters
Name Type Description
target Object The config object.
source Object The object to extend the config object.

Return the command chain to run behaviors.

Returns CommandChain: CommandChain object.

Use this function to acquire a variable from config.js

Parameters
Name Type Description
key String Key to specify the config to return

Returns Object: The requested config value.

Use this function to acquire the identifier object

Returns ObjectIdentifier: Identifier object.

getItem method which you need to override when you are fetching your own data.

Returns Object: The retreived data from the data object.

getList method which you need to override when you are fetching your own data.

Returns Object: The retreived data from the data object.

This is a alias of ObjectManager.getObject to use in the "this" context.

Parameters
Name Type Description
identifier String Identifier of the object to load
config Object|null Config to push to the object

Returns Promise: call ".then" to use the object when ready.

This method will return the table connected to the current model.

Returns Promise: The promise holding the table object as content.

getTotal which has the basic behavior of counting the rows in the current list.

Returns Number: The total amount of rows.

Every object called through getObject will go through this function. This will set the identifier and adds the behaviors (if any).

Parameters
Name Type Description
config Object Object with config values

Returns Promise: call ".then" to use the object when ready.

This is the handler which will try to mixin functions from another object.

Parameters
Name Type Description
object Object The object to mix into the current object.

This method is used to set the states. This method accepts an array or a string as the first parameter. When the first parameter is a string the second parameter will be the value of this state.

Parameters
Name Type Description
name Object|string The state/ array of states to set
value * The value of the state

Returns AbstractModel: The current model with set states.