First of all, I’d like to give you a piece of advice so that you have a better chance of getting an answer, assemble a small one Code Snippet
which reproduces the error.
In your case, you are setting the option aaSorting
as a array vazio
, with Datatable is not defining and much less inferring the type of each column.
So the best thing to do in this example is to omit the aaSorting
, even why this option should not be used in newer versions of DataTables
, in its place you must use the DataTable - Options
, in particular the columns
, columns.type
, columnDefs
and ordering
and finally, to sort a string that has a date in the format dd/MM/yyyy
it is necessary to use the plugin which reference the columns.type
data-eu
, then set the column type to data-eu
.
$(function () {
$("#sla").DataTable({
"columns": [
{ "type": "date-eu" },
{ "type": "date-eu" },
{ "type": "date-eu" },
null,
null
]
});
})
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<link href="https://cdn.datatables.net/1.10.12/css/dataTables.bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.10.12/js/dataTables.bootstrap.min.js"></script>
<script src="https://cdn.datatables.net/plug-ins/1.10.12/sorting/date-eu.js"></script>
<table id="sla" class="table table-striped table-hover">
<thead>
<tr>
<th>Data Problema</th>
<th>Data Previsão</th>
<th>Data Inclusão</th>
<th>Pendência</th>
<th>SLA</th>
</tr>
</thead>
<tbody>
<tr>
<td>10/07/2016</td>
<td>11/07/2016</td>
<td>10/07/2016</td>
<td>Operacional</td>
<td>1 hora</td>
</tr>
<tr>
<td>29/07/2016</td>
<td>29/07/2016</td>
<td>29/07/2016</td>
<td>Energia</td>
<td>4 horas</td>
</tr>
<tr>
<td>02/08/2016</td>
<td>02/08/2016</td>
<td>02/08/2016</td>
<td>Energia</td>
<td>4 horas</td>
</tr>
<tr>
<td>02/08/2016</td>
<td>30/08/2016</td>
<td>02/08/2016</td>
<td>Energia</td>
<td>4 horas</td>
</tr>
<tr>
<td>17/08/2016</td>
<td>18/08/2016</td>
<td>17/08/2016</td>
<td>Operacional</td>
<td>1 hora</td>
</tr>
</tbody>
</table>
Very good this Extend. Made it too easy.
– Washington Morais