给定一个indexeddb数据库,其中一个声明的objectstore为:
var objectStore = thisDb.createObjectStore("table", {keyPath: "id", autoIncrement: true})
Run Code Online (Sandbox Code Playgroud)
当我使用添加请求添加新项目时:
var resp = objectStore.add(row)
Run Code Online (Sandbox Code Playgroud)
如何在onsuccess函数中获取此添加项的新ID?
resp.onsuccess = function(e) { /* code to get the id of the added item */}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1843 次 |
最近记录: |