First of all, I'd like to give you some advice so that you have a better chance of getting an answer, make a little Code Snippet
that reproduces the error.
In your case, you are setting the option aaSorting
to array vazio
, with DataTable not setting, let alone inferring the type of each column.
So the best thing to do in this example is to omit aaSorting
, even though this option should not be used in newer versions of DataTables
, instead you should use DataTable - Options
, especially the columns
, columns.type
, columnDefs
and ordering
Finally, to sort a string that has a date in dd/MM/yyyy
format, you need to use the plugin that references 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><scriptsrc="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><scriptsrc="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><tableid="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>