W3cubDocs

/Dojo

dojo/store/api/Store.QueryResults

Summary

This is an object returned from query() calls that provides access to the results of a query. Queries may be executed asynchronously.

Properties

total

Defined by: dojo/store/api/Store

This property should be included in if the query options included the "count" property limiting the result set. This property indicates the total number of objects matching the query (as if "start" and "count" weren't present). This may be a promise if the query is asynchronous.

Methods

filter(callback,thisObject)

Defined by dojo/store/api/Store

Filters the query results, based on https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/filter. Note that this may executed asynchronously. The callback may be called after this function returns.

Parameter Type Description
callback undefined

Function that is called for each object in the query results

thisObject undefined

The object to use as |this| in the callback.

Returns: dojo/store/api/Store.QueryResults

forEach(callback,thisObject)

Defined by dojo/store/api/Store

Iterates over the query results, based on https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/forEach. Note that this may executed asynchronously. The callback may be called after this function returns.

Parameter Type Description
callback undefined

Function that is called for each object in the query results

thisObject undefined

The object to use as |this| in the callback.

map(callback,thisObject)

Defined by dojo/store/api/Store

Maps the query results, based on https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/map. Note that this may executed asynchronously. The callback may be called after this function returns.

Parameter Type Description
callback undefined

Function that is called for each object in the query results

thisObject undefined

The object to use as |this| in the callback.

Returns: dojo/store/api/Store.QueryResults

observe(listener,includeAllUpdates)

Defined by dojo/store/api/Store

This registers a callback for notification of when data is modified in the query results. This is an optional method, and is usually provided by dojo/store/Observable.

Parameter Type Description
listener Function

The listener function is called when objects in the query results are modified to affect the query result. The listener function is called with the following arguments:

listener(object, removedFrom, insertedInto);
  • The object parameter indicates the object that was create, modified, or deleted.
  • The removedFrom parameter indicates the index in the result array where the object used to be. If the value is -1, then the object is an addition to this result set (due to a new object being created, or changed such that it is a part of the result set).
  • The insertedInto parameter indicates the index in the result array where the object should be now. If the value is -1, then the object is a removal from this result set (due to an object being deleted, or changed such that it is not a part of the result set).
includeAllUpdates undefined

This indicates whether or not to include object updates that do not affect the inclusion or order of the object in the query results. By default this is false, which means that if any object is updated in such a way that it remains in the result set and it's position in result sets is not affected, then the listener will not be fired.

then(callback,errorHandler)

Defined by dojo/store/api/Store

This registers a callback for when the query is complete, if the query is asynchronous. This is an optional method, and may not be present for synchronous queries.

Parameter Type Description
callback undefined

This is called when the query is completed successfully, and is passed a single argument that is an array representing the query results.

errorHandler undefined

This is called if the query failed, and is passed a single argument that is the error for the failure.

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