Created
February 24, 2013 21:08
-
-
Save glynrob/5025626 to your computer and use it in GitHub Desktop.
Indexed DB add row
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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