You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
490 B
JavaScript
21 lines
490 B
JavaScript
/**
|
|
* Sort numeric data which has a percent sign with it.
|
|
* @name Percentage
|
|
* @author <a href="http://jonathanromley.org/">Jonathan Romley</a>
|
|
*/
|
|
|
|
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
|
|
"percent-pre": function ( a ) {
|
|
var x = (a == "-") ? 0 : a.replace( /%/, "" );
|
|
return parseFloat( x );
|
|
},
|
|
|
|
"percent-asc": function ( a, b ) {
|
|
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
|
|
},
|
|
|
|
"percent-desc": function ( a, b ) {
|
|
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
|
|
}
|
|
} );
|