DataStore

(esrith/amos/core/DataStore)

Use for formatting the data into a format that supports control of amos. Class for formating data into format that is usable by AMOS. Type property must be defined then bind method is used to start formating data. For TYPE_JSON, data property must be defined. For TYPE_POST and TYPE_GET, both url and param properties must be defined.

Description
new DataStore(option?)

Create a new DataStore object.

new DataStore(urlparamoption?)

Create a new DataStore object with url and parameters.

new DataStore(dataoption?)

Create a new DataStore object with data.

Description
TYPE_GET

bind data store with json type get

TYPE_JSON

bind data store with json type json

TYPE_POST

bind data store with json type post

Type Description
callback Function

Callback function. This is executed after querying.

data Object

A set of data.

form Node

For posting form data, can provide either the DOM node of your form or the id of the form.

handleAs String

A string representing how to convert the text payload of the response before passing the converted data to the success handler. Possible formats are "text", "json", "javascript", and "xml".

headers Object

Object specifies headers to use for the request.

param Object

Parameter that use to query data from service.

preventCache Boolean

If true, this will send an extra query parameter to ensure the the server won't supply cached values.

sync Boolean

If true, specifies pattern for query data is synchronous.

timeout Number

Time in milliseconds before considering the request a failure and triggering the error handler.

type String

Type of pattern for query data.

url String

Path URL of service to use query data.

useProxy Boolean

If true, it's query by use proxy page.

Return type Description
addCallback(callback) None

Add callback function.

query(callbackerrback) Dojo/Deferred

Query data.

Description
query-completed

Fires when querying is completed.

query-error

Fires when query error occurs.

Constructors Detail
new DataStore(option?)

Create a new DataStore object.

Parameters:
new DataStore(urlparamoption?)

Create a new DataStore object with url and parameters.

Parameters:
  • <String> url Required

    Data url

  • <Object> param Required

    Parameter for retrieving the data

  • <Object> option Optional
new DataStore(dataoption?)

Create a new DataStore object with data.

Parameters:
constants Detail
<String>
TYPE_GET

bind data store with json type get

<String>
TYPE_JSON

bind data store with json type json

<String>
TYPE_POST

bind data store with json type post

Properties Detail
<Function>
callback

Callback function. This is executed after querying.

<Object>
data

A set of data.

<Node>
form

For posting form data, can provide either the DOM node of your form or the id of the form.

<String>
handleAs

A string representing how to convert the text payload of the response before passing the converted data to the success handler. Possible formats are "text", "json", "javascript", and "xml".

Default value: json

<Object>
headers

Object specifies headers to use for the request.

<Object>
param

Parameter that use to query data from service.

<Boolean>
preventCache

If true, this will send an extra query parameter to ensure the the server won't supply cached values.

Default value: false

<Boolean>
sync

If true, specifies pattern for query data is synchronous.

Default value: false

<Number>
timeout

Time in milliseconds before considering the request a failure and triggering the error handler.

Default value: 0

<String>
type

Type of pattern for query data.

Default value: json

<String>
url

Path URL of service to use query data.

<Boolean>
useProxy

If true, it's query by use proxy page.

Default value: true

Methods Detail
addCallback
(
  • callback
)

Add callback function.

Parameters
  • <Function> callback Required

    Function to execute after querying.

<Dojo/Deferred>
query
(
  • callback
  • errback
)

Query data.

Parameters
  • <Function> callback Required

    Function to execute after querying is completed.

  • <Function> errback Required

    Function to execute after a query error occurs.

Events Detail
query-completed

Fires when querying is completed.

Event Payload:
  • <Object> response

    response from query complete

query-error

Fires when query error occurs.

Event Payload:
  • <Object> response

    response from query error