I can not print the records in descending order. I looked at several websites for tips that could help me, but when I adapt to my code, nothing works!
My question is:
I'm creating a game on Intel XDK using Firebase as a database and Javascript to handle them, but I can not display the records in growing order and declining >, which is what I want. Same as a Ranking.
I have the following code:
<html>
<head>
<title></title>
<meta name="viewport" content="width=device-width, initial-scale= 1.0, maximum-scale= 1.0, user-scalable=no />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<script src="https://cdn.firebase.com/js/client/1.0.17/firebase.js"></script><scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.css></script>
</head>
<body>
<table>
<thead>
<th>NOME</th>
<th>TEMPO</th>
<th>ACERTOS</th>
<th>ERROS</th>
</thead>
<tbody id="resultado">
</tbody>
</table>
<script>
$(document).ready(function(){
var APP = new Firebase("https://testestroop-c52df.firebaseio.com/");
APP.ref().child('jogada').on('child_added', function(snap){
var jogada = snap.val();
var tr = document.createElement('tr');
var td1 = document.createElement('td');
var td2 = document.createElement('td');
var td3 = document.createElement('td');
var td4 = document.createElement('td');
td1.appendChild(document.createTextNode(jogada.nomeJogador));
tr.appendChild(td1);
td2.appendChild(document.createTextNode(jogada.tempo));
tr.appendChild(td2);
td3.appendChild(document.createTextNome(jogada.acertos));
tr.appendChild(td3);
td4.appendChild(document.createTextNode(jogada.erros));
tr.appendChild(td4);
resultado.appendChild(tr);
}
});
</script>
</body>
</html>
And in this image below is the structure of the database in Firebase:
Thank you very much for your help.