1
0
mirror of https://github.com/billz/raspap-webgui.git synced 2023-10-10 13:37:24 +02:00
raspap-webgui/bower_components/datatables-plugins/sorting/scientific.js

30 lines
765 B
JavaScript
Raw Normal View History

2015-02-25 14:08:14 +01:00
/**
* This plug-in will treat numbers which are in scientific notation (for
* example `1E-10`, `1.2E6` etc) and sort them numerically.
*
* @name Scientific notation sorting
* @summary Sort data which is written in exponential notation.
* @author [Nick Schurch](http://datatables.net/forums/profile/21757/nickschurch)
*
* @example
* $('#example').dataTable( {
* columnDefs: [
* { type: 'scientific', targets: 0 }
* ]
* } );
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"scientific-pre": function ( a ) {
return parseFloat(a);
},
"scientific-asc": function ( a, b ) {
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"scientific-desc": function ( a, b ) {
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
} );