Programming HTML5 Applications by Zachary Kessin

Programming HTML5 Applications by Zachary Kessin

Author:Zachary Kessin
Language: eng
Format: epub, pdf
ISBN: 9781449322724
Publisher: O'Reilly Media


Retrieving Data

After data has been added to an object store, there must be a way to query and display it. There are several ways of interest to query data. The program may wish to display all the data, a subset of the data, or just one row.

To retrieve one row, identified by its primary key, use the get method as shown in Example 5-7. This method returns a promise object which is accessed via the then method. The then takes two functions as callbacks: the first is called on success with the object from the database, and the second, in case of error, with an error object.

Example 5-7. Get one row

$.indexeddb(db).objectStore(objectStore).get(primaryKey).then(wrap, err);



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.