JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="//cdn.datatables.net/1.10.11/css/jquery.dataTables.min.css">
<script src="//cdn.datatables.net/1.10.11/js/jquery.dataTables.min.js"></script>
<table id="example">
<thead>
<tr>
<td>Nome</td>
<td>Salario</td>
</tr>
</thead>
<tbody>
<tr>
<td>João</td>
<td>R$ 2.150,00</td>
</tr>
<tr>
<td>Maria</td>
<td>8.750,00</td>
</tr> <tr>
<td>Pedro</td>
<td>R$ 500,00</td>
</tr> <tr>
<td>Ana</td>
<td>R$ 3.580,00</td>
</tr>
</tbody>
</table>
JavaScript
/*
* datatables.currency-all
*
* Copyright (c) 2016 Guilherme Nascimento ([email protected]); Renilson Meneguci ([email protected])
*
* Released under the MIT license
*
* Navigate to: https://github.com/DataTables/DataTables
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"all-currency-pre": function ( a ) {
a = (a==="-") ? 0 : parseFloat(a.replace( /[^\d\-\,]/g, "" ).replace( /,/g, "." ));
return parseFloat( a );
},
"all-currency-asc": function(a,b) {
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"all-currency-desc": function(a,b) {
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
});
$('#example').dataTable({
"aoColumnDefs": [
{"sType": "all-currency", "aTargets": [1]}
]
});