From 0237135a5e43bd8d129f17dbe35ee0e395a52da3 Mon Sep 17 00:00:00 2001 From: xianzai Date: Mon, 24 Aug 2015 20:25:20 +0800 Subject: [PATCH] add large file size support and remove whitespace before sorting --- sorting/file-size.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sorting/file-size.js b/sorting/file-size.js index 5440fb1..1685105 100644 --- a/sorting/file-size.js +++ b/sorting/file-size.js @@ -19,7 +19,7 @@ */ jQuery.fn.dataTable.ext.type.order['file-size-pre'] = function ( data ) { - var units = data.replace( /[\d\.]/g, '' ).toLowerCase(); + var units = data.replace( /[\d\.\s]/g, '' ).toLowerCase(); var multiplier = 1; if ( units === 'kb' ) { @@ -31,6 +31,12 @@ jQuery.fn.dataTable.ext.type.order['file-size-pre'] = function ( data ) { else if ( units === 'gb' ) { multiplier = 1000000000; } + else if ( units === 'tb' ) { + multiplier = 1000000000000; + } + else if ( units === 'pb' ) { + multiplier = 1000000000000000; + } return parseFloat( data ) * multiplier; };