aps/Store

Generic store used to work with HTTP endpoints supporting REST. The endpoint should support Resource Query Language for filtering and must return the ``Content-Range`` HTTP header for paging the printed content.

Example

var vpsStore = new Store({
   apsType:   "http://aps-standard.org/samples/basic/vps/1.0",
   target:    "/aps/2/resources/"
});

Parameters

ARGUMENT

TYPE

DESCRIPTION

options

dojo.store.JsonRest

This provides any configuration information that will be mixed into the store apsType: the type of apsResource

Examples

var vpsStore = new Store({
    apsType:   "http://aps-standard.org/samples/basic/vps/1.0",
    target:    "/aps/2/resources/"
});

Public Properties

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 the property in the data property that contains the list of child objects.

idProperty

string

id

If the store has a single primary key, this indicates the property to use as the identity property.

initialData

array

null

Data preload for Store.

target

string

“”

The target base URL to use for all requests to the server.

baseQuery string

RQL statement that will be added to every request for a list of resources. Default value: null.

childrenProperty string

The name of the property in the data property that contains the list of child objects. Default value: undefined.

idProperty string

If the store has a single primary key, this indicates the property to use as the identity property. The values of this property should be unique. Default value: “id”.

initialData array

Data preload for Store. Default value: null.

target string

The target base URL to use for all requests to the server. This string will be prepended to the id to generate the URL (relative or absolute) for requests sent to the server. Default value: “”.

Public Methods

METHOD

RETURN

DESCRIPTION

get ()

object

Retrieves an object by its identity

getIdentity (object)

any

Returns an object’s identity

mapQuery (row)

row
object

Method for preparing data before completing request

put ()

dojo/_base/deferred

Stores an object

query (query, options)

instance

remove ()

dojo/_base/deferred

Deletes an object by its identity

get

Retrieves an object by its identity. This will trigger a GET request to the server using the url this.target + id.

Return: object

getIdentity

Returns an object’s identity.

Return: any

ARGUMENT

TYPE

DESCRIPTION

object

Object

The object to store.

mapQuery

Method for preparing data before completing request

Return: row object

ARGUMENT

TYPE

DESCRIPTION

row

Object

Received from server row which must be processed

put

Stores an object. This will trigger a PUT request to the server if the object has an id, otherwise it will trigger a POST request.

Return: dojo/_base/deferred

query

Return: instance

ARGUMENT

TYPE

DESCRIPTION

query

undefined

options

__HeaderOptions

HTTP headers.

remove

Deletes an object by its identity. This will trigger a DELETE request to the server.

Return: dojo/_base/deferred