Hi there, im using dataTables with "Hidden title numeric sorting" plugin because my table rows look like this:
1,100.30
8,000.10
120.50
using "," as thousand separators. But im getting the rows sorted like:
1,100.30
120.50
8,000.10
What i've added is this as javascript:
and my html is:
<td>1</td>
<td>2</td>
<td><span title="1100.30">1,100.30</span></td>
<td>4</td>
Can someone help me please?
1,100.30
8,000.10
120.50
using "," as thousand separators. But im getting the rows sorted like:
1,100.30
120.50
8,000.10
What i've added is this as javascript:
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"title-numeric-pre": function ( a ) {
var x = a.match(/title="*(-?[0-9\.]+)/)[1];
return parseFloat( x );
},
"title-numeric-asc": function ( a, b ) {
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"title-numeric-desc": function ( a, b ) {
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
} );
oTable = $('#reprtable').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"sDom": '<""f>t<"F"lp>',
"aoColumns": [
null,
null,
{ "sType": "title-numeric" },
null
]
});
and my html is:
<td>1</td>
<td>2</td>
<td><span title="1100.30">1,100.30</span></td>
<td>4</td>
Can someone help me please?