Created
November 5, 2013 22:58
-
-
Save csessig86/7327877 to your computer and use it in GitHub Desktop.
Format number column with DataTables
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery.extend( jQuery.fn.dataTableExt.oSort, { | |
"formatted-num-pre": function ( a ) { | |
a = (a === "-" || a === "") ? 0 : a.replace( /[^\d\-\.]/g, "" ); | |
return parseFloat( a ); | |
}, | |
"formatted-num-asc": function ( a, b ) { | |
return a - b; | |
}, | |
"formatted-num-desc": function ( a, b ) { | |
return b - a; | |
} | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment