After getting the data from firebase, the first line in the datatable is showing no data available. How should I correct this?
I know I'm only using one data set but I try with 10 data it's still showing that there is no data available in the first line.
I tried everything I know but nothing works.
My js code
$(document).ready(function() { $('#user_data').DataTable({ dom: 'Bfrtip', colums: [ { title: "USN" }, { title: "Email" }, { title: "Name" }, { title: "Password" } ], targets: -1, className: 'dt-body-right', hover: 1, }); }); var rootRef = firebase.database().ref().child("StudentID"); rootRef.on("child_added", snap => { USN = snap.child("UserUSN").val(); Email = snap.child("Useremail").val(); Name = snap.child("Username").val(); Password = snap.child("Userpassword").val(); $("#table-body-pengguna").append("<tr><td>" + USN + "</td><td>" + Email + "</td><td>" + Name + "</td><td>" + Password + "</td></tr>"); }) My html code
<body> <table id="user_data" class="display" width="100%" cellspacing="0"> <thead> <tr> <th>USN</th> <th>Email</th> <th>Name</th> <th>Password</th> </tr> </thead> <tbody id="table-body-pengguna"> </tbody> </table> https://stackoverflow.com/questions/66920676/no-data-available-in-first-line-of-data-table April 02, 2021 at 10:17PM
没有评论:
发表评论