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.
Plugins/sorting/num-html.js

26 lines
774 B
JavaScript

/**
* This sorting plug-in allows for HTML tags with numeric data. With the 'html'
* type it will strip the HTML and then sorts by strings, with this type it
* strips the HTML and then sorts by numbers. Note also that this sorting
* plug-in has an equivalent type detection plug-in which can make integration
* easier.
* @name Numbers with HTML
13 years ago
* @anchor numbers_html
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"num-html-pre": function ( a ) {
var x = a.replace( /<.*?>/g, "" );
return parseFloat( x );
},
"num-html-asc": function ( a, b ) {
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"num-html-desc": function ( a, b ) {
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
} );