continue method

Advances the position of cursor object to the next object.

Internet Explorer 10

 

Syntax

IDBCursor.continue(key);

Parameters

key [in, optional]

Type: any

If specified, the cursor skips the number of objects specified by the value of this parameter. If blank or not specified, the next object is selected.

Return value

This method does not return a value.

Exceptions

This method can throw the following DOMException exceptions:

Note  As of Internet Explorer 10, the code property is deprecated in favor of the name property, which is preferred for standards compliance and future compatibility.
Exception propertiesCondition
name: DataError

The value specified for the key parameter is not valid.

name: TransactionInactiveError

The transaction associated with the cursor is not active.

name: InvalidStateError
code: DOMException.INVALID_STATE_ERR (11)

The cursor is already iterating or has reached the last object.

 

Standards information

Remarks

When the continue method causes the cursor to advance to a new record, the onsuccess handler is called and the target property of the event object points to the new record. If there is no new record, the target.result property for the event object is null.

Examples

The following example opens an object store in order to collect and count the values in the object store. For more info about this sample, see How to create a tag cloud using IndexedDB.


     var oTagWords = { };
     var hTransaction = hDBHandle.transaction( "ImageTags", "readonly" );
     var hObjectStore = hTransaction.objectStore( "ImageTags" );
     var hIdxWords = hObjectStore.index( "IxTagsByWord" );
     var hRequest = hIdxWords.openCursor();

     hRequest.onsuccess = function( evt ) {
   
        var oCursor = evt.target.result;
        if ( oCursor ) {
           var sTagWord = oCursor.value.TagWord;
           if ( sTagWord in oTagWords ) {
              oTagWords[ sTagWord ]++;
           } else {
              oTagWords[ sTagWord ] = 1;
           }
           oCursor.continue();
        } else {
           writeTagCloud( oTagWords );
        }
     }


See also

IDBCursor

 

 

Show: