From a51940723b8e688c999852b96fdc9ab27e24153e Mon Sep 17 00:00:00 2001 From: Alexander Date: Thu, 25 Feb 2016 11:07:11 +0300 Subject: [PATCH] Fix exception when data field is empty Treat empty fields (empty data variable) as '-1' digit. While sorting put this fields to the end/beginning. --- sorting/file-size.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sorting/file-size.js b/sorting/file-size.js index 017a5a0..f38597d 100644 --- a/sorting/file-size.js +++ b/sorting/file-size.js @@ -29,6 +29,10 @@ jQuery.fn.dataTable.ext.type.order['file-size-pre'] = function ( data ) { pb: 1000000000000000 }; - var multiplier = multipliers[matches[2].toLowerCase()]; - return parseFloat( matches[1] ) * multiplier; + if (matches) { + var multiplier = multipliers[matches[2].toLowerCase()]; + return parseFloat( matches[1] ) * multiplier; + } else { + return -1; + }; };