File: demos/startbootstrap-sb-admin-2/bower_components/datatables-plugins/type-detection/file-size.js

Recommend this page to a friend!
  Classes of Emmanuel Podvin   Blapy   demos/startbootstrap-sb-admin-2/bower_components/datatables-plugins/type-detection/file-size.js   Download  
File: demos/startbootstrap-sb-admin-2/bower_components/datatables-plugins/type-detection/file-size.js
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Blapy
jQuery plugin to load linked pages using AJAX
Author: By
Last change: Update of demos/startbootstrap-sb-admin-2/bower_components/datatables-plugins/type-detection/file-size.js
Date: 3 years ago
Size: 884 bytes
 

Contents

Class file image Download
/** * Detect "file size" type columns automatically. Commonly used for computer * file sizes, this can allow sorting to take the order of magnitude indicated * by the label (GB etc) into account. * * @name File size * @summary Detect abbreviated file size data (8MB, 4KB etc) * @author _anjibman_ */ jQuery.fn.dataTableExt.aTypes.unshift( function ( sData ) { var sValidChars = "0123456789"; var Char; /* Check the numeric part */ for ( var i=0 ; i<(sData.length - 3) ; i++ ) { Char = sData.charAt(i); if (sValidChars.indexOf(Char) == -1) { return null; } } /* Check for size unit KB, MB or GB */ if ( sData.substring(sData.length - 2, sData.length) == "KB" || sData.substring(sData.length - 2, sData.length) == "MB" || sData.substring(sData.length - 2, sData.length) == "GB" ) { return 'file-size'; } return null; } );