How can we sort currency column in datatable
How can we sort currency column in datatable
prathna
Posts: 1Questions: 1Answers: 0
We have already add this code but not work:
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"currency-pre": function ( a ) {
a = (a==="-" || a === "") ? 0 : a.replace( /[^\d-.]/g, "" );
return parseFloat( a );
},
"currency-asc": function ( a, b ) {
return a - b;
},
"currency-desc": function ( a, b ) {
return b - a;
}
} );
-$971.27
Answers
It should be picked up automatically - see the final column in this example.
If it isn't for you, please link to a test case showing the issue, per the forum rules.
Allan