I'm using the Bootstrap SB Admin2, which makes use of the DataTables component.
In my jsp page I'm loading the following table:
<table class="table table-striped table-bordered table-hover" id="dataTables-example">
<thead>
<tr>
<th>Código</th>
<th>Nome RCA</th>
<th>Meta</th>
</tr>
</thead>
<tbody>
<c:forEach var="rca" items="${listaTeste }">
<tr class="odd gradeX">
<td>${rca.codusur }</td>
<td>${rca.nome }</td>
<td style="text-align: right">${rca.meta }</td>
</tr>
</c:forEach>
</tbody>
</table>
and the following code for the javascript:
<script>
$(document).ready(function() {
$('#dataTables-example').DataTable({
responsive: true,
"order": [2, 'asc']
});
});
</script>
In this way the code works, for example:
2512 Aa 227,27
5769 Ma 2.318,18
2945 Mb 4.772,72
However, if I request a formatting for jstl like this:
<td style="text-align: right"><fmt:formatNumber value="${rca.meta }" type="currency" /></td>
The table is sorted like this:
5769 Ma R$ 2.318,18
2512 Aa R$ 227,27
2945 Mb R$ 4.772,72
From what I understand it looks like it is reading as string, some solution to this case? I have already looked at the documentation and found nothing.
PS : I'm sorry for the length of the question, I'm new here but wanted to explain all the details.
I tried to change the pattern in fmtNumber, using pattern="#,##0.00"
, and the classification remains wrong, but using pattern="0.00"
only so it can sort.