0
todos divにデータをフェッチしているが、クリック機能でデータを表示していないが、データが正常に追加されているreadAll()関数を作成しました。インデックスdbが表示されていません。今私は最初に私はちょうど私はちょうどjavascriptからhtmlにデータを追加しているテーブルを空にしている。indexeddbからデータを取り出してdivに表示する方法
今私はちょうど私が今私は、私はテーブルのヘッドを使用していdivの内部IDビューのdiv要素を作成している$(".clickme").click(function(){
readAll();
});
READALL関数を呼び出していますクリックで関数を呼び出しています
function readAll() {
var objectStore = db.transaction("todostore").objectStore("todostore");
$("#todos").empty();
objectStore.openCursor().onsuccess = function(event) {
var cursor = event.target.result;
if (cursor) {
$("#todos").append("<tr><td>" + cursor.key + "</td><td>" + cursor.value.todo + "</td><td><button onclick=\"update('" + cursor.key + "','" + cursor.value.todo + "')\">Update</button></td><td><button onclick=\"removetodo('" + cursor.key + "','" + cursor.value.todo + "')\">Delete</button></td></tr>");
cursor.continue();
}
};
};
ただのJavaScriptのコードを追加し、HTMLに移入IDBとして
<div id="view">
<thead>
<tr class="ui-bar-d">
<th data-priority="2">Timestamp</th>
<th data-priority="1">To Do</th>
<th data-priority="3">Update</th>
<th data-priority="4">Delete</th>
</tr>
</thead>
<tbody id="todos">
</tbody>
</table>
</div>
<label for="todo">To Do:</label>
<input id="todo" type="text">
<input id="toprice" type="text">
<button class="clickme">clickme</button>
<button class="ui-shadow ui-btn ui-corner-all" onclick="add()">Add</button>
あなたのHTMLが不正な形式です。 – sweaver2112
あなたはどこに間違いがあるのか教えてください –
が見つからない
答えて
はasync.Youはあなたが....
機能だ呼び出す必要がありますですhttps://developer.mozilla.org/en-US/docs/Web/API/IDBTransaction/oncomplete
出典
2016-12-09 19:28:10
関連する問題