W3cubDocs

/Dojo

dojo/main.store

Properties

util

Defined by: dojo/store/util/QueryResults

Methods

Cache(masterStore,cachingStore,options)

Defined by dojo/store/Cache

Parameter Type Description
masterStore undefined
cachingStore undefined
options undefined

Returns: undefined

DataStore()

Defined by dojo/store/DataStore

JsonRest()

Defined by dojo/store/JsonRest

Memory()

Defined by dojo/store/Memory

Observable(store)

Defined by dojo/store/Observable

The Observable store wrapper takes a store and sets an observe method on query() results that can be used to monitor results for changes.

Observable wraps an existing store so that notifications can be made when a query is performed.

Parameter Type Description
store dojo/store/api/Store

Returns: undefined

Examples

Example 1

Create a Memory store that returns an observable query, and then log some information about that query.

var store = Observable(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}
    ]
}));
var changes = [], results = store.query({ prime: true });
var observer = results.observe(function(object, previousIndex, newIndex){
    changes.push({previousIndex:previousIndex, newIndex:newIndex, object:object});
});

See the Observable tests for more information.

© 2005–2017 JS Foundation
Licensed under the AFL 2.1 and BSD 3-Clause licenses.
http://dojotoolkit.org/api/1.10/dojo/main.store.html