首页 > 解决方案 > IndexedDb 列名

问题描述

是否可以从 indexeddb 获取所有列名?或者我如何映射来自 indexeddb 的结果并附加到对象

var data = new FormData();
var myDB = window.indexedDB.open("myDb");
myDB.onsuccess = function () {
   this.result.transaction("myTable").objectStore("myTable").getAll().onsuccess = function (event) {
       var result = event.target.result;
       $.each(result, function (i, tableData) {
            // I would like to map all column data and append to an object
            data.append("colName","ColValue"); // I would like the column name to be dynamic here instead of hardcode like say if 
            I have column name like Name, Address I would like to append to object.
       });
    }

这是我在 indexeddb 中的示例数据的样子

在此处输入图像描述

标签: javascriptindexeddb

解决方案


推荐阅读