mirror of
https://github.com/dawidolko/Website-Templates.git
synced 2026-03-23 01:42:19 +00:00
Website templates
This commit is contained in:
34
startbootstrap-sb-admin-2-1.0.5/bower_components/datatables-plugins/sorting/percent.js
vendored
Normal file
34
startbootstrap-sb-admin-2-1.0.5/bower_components/datatables-plugins/sorting/percent.js
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Sort numeric data which has a percent sign with it.
|
||||
*
|
||||
* DataTables 1.10+ has percentage data type detection and sorting abilities
|
||||
* built-in. As such this plug-in is marked as deprecated, but might be useful
|
||||
* when working with old versions of DataTables.
|
||||
*
|
||||
* @name Percentage
|
||||
* @summary Sort numeric data with a postfixed percentage symbol
|
||||
* @deprecated
|
||||
* @author [Jonathan Romley](http://jonathanromley.org/)
|
||||
*
|
||||
* @example
|
||||
* $('#example').dataTable( {
|
||||
* columnDefs: [
|
||||
* { type: 'percent', targets: 0 }
|
||||
* ]
|
||||
* } );
|
||||
*/
|
||||
|
||||
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));
|
||||
}
|
||||
} );
|
||||
Reference in New Issue
Block a user