Need help sorting numbers with comman and dot like 1,512,542.85 / 985,124.05 / 7,542.12

Need help sorting numbers with comman and dot like 1,512,542.85 / 985,124.05 / 7,542.12

edwiniedwini Posts: 2Questions: 0Answers: 0
edited September 2011 in General
Need help sorting numbers with comman and dot like 1,512,542.85 / 985,124.05 / 7,542.12

How could i do this? I already check this

http://datatables.net/release-datatables/examples/plug-ins/sorting_plugin.html

but i can't make it works

Replies

  • edwiniedwini Posts: 2Questions: 0Answers: 0
    i solved i read this

    http://datatables.net/forums/discussion/472/sorting-money-brasil#Item_9 and i could make my own js

    jQuery.fn.dataTableExt.oSort['honduran-desc'] = function(a,b) {
    var x = (a == "-") ? 0 : a.replace( /,/g, "" ).replace( /\./, ".");
    var y = (b == "-") ? 0 : b.replace( /,/g, "" ).replace( /\./, ".");
    x = parseFloat( x );
    y = parseFloat( y );
    return ((x < y) ? 1 : ((x > y) ? -1 : 0));
    };
This discussion has been closed.