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>Name</td>
<td>Salary</td>
</tr>
</thead>
<tbody>
<tr>
<td>Myke</td>
<td>$ 2.150,00</td>
</tr>
<tr>
<td>Marie</td>
<td>$ 8.750,00</td>
</tr> <tr>
<td>Andrew</td>
<td>$ 500,00</td>
</tr> <tr>
<td>Dominika</td>
<td>$ 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]}
]
});