Skip to content

Instantly share code, notes, and snippets.

@csessig86
Last active December 14, 2015 19:48
Show Gist options
  • Save csessig86/5138901 to your computer and use it in GitHub Desktop.
Save csessig86/5138901 to your computer and use it in GitHub Desktop.
DataSet > DataTables part 1
// DataTables currency
// Use to sort the table via currency
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"currency-pre": function ( 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;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment