Intento ordenar por ACEPTACION
, como lo hago?
quiero usar DataTables de jQuery para usar
order: [
[3, 'asc']
let validacion = [1, 3, 5, 4, 2];
let personas = ["ana", "juan", "pedro", "maria", "gustavo"];
var html = "<table border=2 id='examples'>";
html += "<thead>";
html += "<tr><th colspan='3'>Validacion de " + " </th></tr>";
html += "<tr>";
html += "<th > Parametros </th>";
html += "<th > Aceptacion </th> </thead><tbody>";
for (let i = 0, y = 0; i < validacion.length; i++, y = y + 2) {
html += "<tr>";
html += "<td>" + personas[i] + "</td>";
html += "<td>" + validacion[i] + "</td>";
html += "</tr>";
}
html += "</tbody>";
html += "</table>";
document.getElementById("tabla").innerHTML = html;
$(document).ready(function() {
$('#myTable').DataTable({
"order": [
[1, "desc"]
]
});
});
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
td,
th {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
tr:nth-child(even) {
background-color: #dddddd;
}
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https:////cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<div id='tabla'>tabla</div>