Module: adapter

Adapter: a viewless component which keeps track of child nodes and the data for the nodes
Parameters:
Name Type Description
node object The configuration object for the module
Properties
Name Type Attributes Default Description
type string 'adapter' The type of the node is adapter
id string The id for the module
lazy boolean <optional>
false If the child nodes need to be lazily loaded (e.g. delay creation of children viewmodels until data returns)
persist boolean <optional>
false If data object should be persisted from one fetch data call to the next (upon refresh)
dataSourceEndpoint object | Array.<Object> <optional>
An object defining the endpoint(s) that makes the ajax calls
Properties
Name Type Attributes Description
uri string The uri for the endpoint
url string <optional>
The url for the endpoint
keyMap array | object <optional>
A mapper object or array of mapper objects to map keys
Properties
Name Type Attributes Description
resultsKey string <optional>
Map the results from the ajax call with this key
dataKey string <optional>
Extend the data object with this key
storeKey string <optional>
Place the resultsByKey inside of the store with this key
options object <optional>
Options for the ajax call
children array The json configuration for children nodes which will be mapped to view models and kept track of from the adapter
plugins array <optional>
The json configuration for plugins which will be accessible from getValue function, based upon type
Properties:
Name Type Description
mappedChildNodes array the mapped children nodes
data observable the data retrieved from dataSourceEndpoint and tracked from children
contextPlugins object an object that contains the plugins which have been added to the adapter context
the context context for the adapter (which can be utilized in a custom template)
dispose function the dispose function for all internal subs
Source:
Example
{
     "type": "adapter",
     "id": "ADAPTER_ID",
     "dataSourceEndpoint": [
         {
             "uri": "endpoint/uri",
             "options": {
                 "type": "PUT"
             },
             "keyMap": {
                 "dataKey": "a",
                 "resultsKey": "b"
             }
         }
     ],
     "children": [
         // children json configuration goes here
     ]
}