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 |
---|---|---|---|
string |
null |
RQL statement that will be added to every request for a list of resources. |
|
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 |
---|---|---|
number
|
Returns an object’s identity |
|
row
object
|
Method for preparing data before completing request |
|
Stores an object |
||
dojo/store/api/store.queryresults
|
Queries the store for objects |
|
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
|
The object to get the identity from. |
Method for preparing data before completing request.
Return: row object
ARGUMENT |
TYPE |
DESCRIPTION |
---|---|---|
|
Object
|
Received from server row which must be processed. |
Stores an object.
ARGUMENT |
TYPE |
DESCRIPTION |
---|---|---|
|
Object
|
The object to store. |
|
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 |
---|---|---|
|
Object
|
The query to use for retrieving objects from the store. |
|
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 |
---|---|---|
|
Object[]
|
An array of objects to use as the source of data. |