W3cubDocs

/Dojo

dojo/store/util/QueryResults

Summary

A function that wraps the results of a store query with additional methods.

QueryResults is a basic wrapper that allows for array-like iteration over any kind of returned data from a query. While the simplest store will return a plain array of data, other stores may return deferreds or promises; this wrapper makes sure that all results can be treated the same.

Additional methods include forEach, filter and map.

Usage

QueryResults(results);
Parameter Type Description
results Array | dojo/promise/Promise

The result set as an array, or a promise for an array.

Returns: any | Array|dojo/promise/Promise | undefined

An array-like object that can be used for iterating over.

See the dojo/store/util/QueryResults reference documentation for more information.

Examples

Example 1

Query a store and iterate over the results.

store.query({ prime: true }).forEach(function(item){
    //  do something
});

Methods

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