StoreQueryResults interface

A JavaScript object implementing the StoreQuery interface represents the result of an object store query, and acts as an array of StoreObject objects.

Construction

Call execute() on a StoreQuery object.

Interface

acts as Array

The query results behave as a read-only JavaScript Array. You can use the [] operator to retrieve a StoreObject at the given index in the results.

property length

Number of results.

function each(iterator)

Calls iterator, once for each object. Arguments are (object, index), where object is a StoreObject and index is the index of the object in the results.

Return true from the iterator function to stop the iteration immediately.

function ensureRangeLoaded(startIndex, endIndex)

If this is a sparse result set, requested by calling setSparseResults(true) on the query object, use this function to load a range of objects.

This is more efficient than just loading each object individually by accessing the array.

You shouldn’t call this if you just using refAtIndex().

function refAtIndex(index)

Returns the Ref of the object at index.

For sparse result sets, this is efficient whether or not ensureRangeLoaded() has been called.