how can initializing datatable after take my data in FIREBASE?
how can initializing datatable after take my data in FIREBASE?
Luyz
Posts: 2Questions: 1Answers: 0
I have a problem when I take my data from FireBase and tried to display this data in the data table, because datatable Initializes before
My code is this:
$(document).ready(function(){
firebase.database().ref('Usuarios').on('child_added',function(snapshot) {
var dataSet = [[snapshot.key, snapshot.val().Nombre];
});
$('#myTable').DataTable({
"bFilter": false,
data: dataSet
});
});
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You would need to either:
rows.add()
to add the rows.Allan
Thank Allan, It's done
var table = $('#myTable').DataTable ( {
"bFilter": false
} );
firebase.database().ref('Usuarios').on('child_added',function(snapshot) {
var dataSet = [snapshot.key, snapshot.val().Nombre];
table.rows.add([dataSet]).draw();
});