This is a basic in-memory object store. It implements ``dojo.store.api.Store``.
Table of contents
All user panels - CP and UX1
var data = [{
aps: {id: "1"},
info: {title: "Server 1"},
params: {
disk: 152,
ram: 199,
cpu: 2
}
}, {
aps: {id: "2"},
info: {title: "Server 2"},
params: {
disk: 152,
ram: 917,
cpu: 965
}
}];
var store = new Memory({
data: data,
idProperty: "aps.id"
});
PROPERTY | TYPE | DEFAULT | DESCRIPTION |
---|---|---|---|
baseQuery | string | null | RQL statement that will be added to every request for a list of resources. |
childrenProperty | string | undefined | The name of property in data object that contains list of sub objects. |
RQL statement that will be added to every request for a list of resources. Default value: null.
The name of property in data object that contains list of sub objects. Default value: undefined.
METHOD | RETURN | DESCRIPTION |
---|---|---|
getIdentity (object) | number
|
Returns an object’s identity |
mapQuery (row) | row
object
|
Method for preparing data before completing request |
put (object, options) | Stores an object | |
query (query, options) | dojo/store/api/store.queryresults
|
Queries the store for objects |
setData (data) | undefined
|
Sets the given data as the source for this store, and indexes it |
Returns an object’s identity.
Return: number
ARGUMENT | TYPE | DESCRIPTION |
---|---|---|
object |
Object
|
The object to get the identity from. |
Method for preparing data before completing request.
Return: row object
ARGUMENT | TYPE | DESCRIPTION |
---|---|---|
row |
Object
|
Received from server row which must be processed. |
Stores an object.
ARGUMENT | TYPE | DESCRIPTION |
---|---|---|
object |
Object
|
The object to store. |
options |
Store.PutDirectives
|
Additional metadata for storing the data. Includes an “id” property if a specific id is to be used. returns: Number |
Queries the store for objects.
Return: dojo/store/api/store.queryresults
ARGUMENT | TYPE | DESCRIPTION |
---|---|---|
query |
Object
|
The query to use for retrieving objects from the store. |
options |
Object
|
The additional parameters sent to the originating _SearchMixin’s store, including: start, count, queryOptions. |
Given the following store:
var store = new Memory({
data: [
{id: 1, name: "one", prime: false },
{id: 2, name: "two", even: true, prime: true},
{id: 3, name: "three", prime: true},
{id: 4, name: "four", even: true, prime: false},
{id: 5, name: "five", prime: true}
]
});
…find all items where “prime” is true:
var results = store.query({ prime: true });
…or find all items where “even” is true:
var results = store.query({ even: true });
Sets the given data as the source for this store, and indexes it
Return: undefined
ARGUMENT | TYPE | DESCRIPTION |
---|---|---|
data |
Object[]
|
An array of objects to use as the source of data. |