Skip to content

Instantly share code, notes, and snippets.

@glynrob
Created February 24, 2013 21:08
Show Gist options
  • Save glynrob/5025626 to your computer and use it in GitHub Desktop.
Save glynrob/5025626 to your computer and use it in GitHub Desktop.
Indexed DB add row
function addRow(title) {
var obj = { title: title }; // structure of the object to save
var store = getObjectStore(DB_TABLE_NAME, 'readwrite');// get the object store allowing read and write
var req;
try {
req = store.add(obj); // add row
} catch (e) {
throw e;
}
req.onsuccess = function (evt) { // success - display table columns
displayRows(store);
};
req.onerror = function() { // fail - display error
displayActionFailure(this.error);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment