...
/Using Cursor to Update and Delete Data of the Object Store
Using Cursor to Update and Delete Data of the Object Store
Learn how to update and delete the data of the object store using the cursor.
We'll cover the following...
We can alter or remove the data while iterating through data with a cursor. This is done using the update()
method for changes and the delete()
method for deletions.
The update()
method
The update()
method will commit the value provided into the object store.
Syntax
cursorObject.update(new_value)
Syntax for the update() method
This method takes the new_value
to be updated as an argument and returns an IDBRequest
object as a return value. We can add the success
and error
event listeners to the returned object to listen for the state of the update operation.