I am new in firebase, could anyone tell me how can I retrieve the values if there are two children under the child "status" , this is my code
function tampil(){
ordersRef.on("value", function(snapshot)
{
var data = snapshot.val();
var files ="";
for(var key in data)
{
files += "<tr>"+
"<td>" + data[key].name + "</td>"+
"<td>" + data[key].order_date + "</td>"+
"<td>" + data[key].alamat + "</td>"+
"<td>" + data[key].status + "</td>"+
'<td>'+'<button class="btn btn-primary edit" data-validasi="'+key+'">Edit</button>'+'</td>' +
'<td>'+'<button class="btn btn-danger hapus" data-validasi="'+key+'">Hapus</button>'+'</td>' +
"<tr>";
}
tableValidasi.innerHTML= files;
if (files !="") {
var elementEditTabel = document.getElementsByClassName("edit");
for (var i =0; i<elementEditTabel.length; i++) {
elementEditTabel[i].addEventListener("click",editaFirebase,false); }
var elementHapusTable = document.getElementsByClassName("hapus");
for (var i =0; i<elementHapusTable.length; i++) {
elementHapusTable[i].addEventListener("click",hapusFirebase,false); }
}
});
}
Aucun commentaire:
Enregistrer un commentaire