How to use Hidden title numeric sorting for thousands separator

How to use Hidden title numeric sorting for thousands separator

felixjetfelixjet Posts: 1Questions: 0Answers: 0
edited June 2012 in Plug-ins
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:

[code]
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
]
});
[/code]

and my html is:

1
2
1,100.30
4


Can someone help me please?

Replies

  • oprogfrogooprogfrogo Posts: 6Questions: 0Answers: 0
    edited October 2012
    Did you ever get this working? The example on the site is really not helpful.
This discussion has been closed.