From 29be7c6fb7b8dad2638baa7bd327d3e0137d696c Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Tue, 12 Jun 2012 15:34:40 +0100 Subject: [PATCH] Currency detection update form Nuno Gomes - make addition of extra symbols easier - add euro --- type-detection/currency.js | 46 +++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/type-detection/currency.js b/type-detection/currency.js index 4fce042..dd6efc8 100644 --- a/type-detection/currency.js +++ b/type-detection/currency.js @@ -5,34 +5,30 @@ * in conjunction with the currency sorting plug-in. * @name Currency * @anchor currency - * @author Allan Jardine + * @author Allan Jardine, Nuno Gomes */ -jQuery.fn.dataTableExt.aTypes.unshift( - function ( sData ) - { - var sValidChars = "0123456789.-,"; - var Char; +jQuery.fn.dataTableExt.aTypes.unshift( + function ( sData ) + { + var sValidChars = "0123456789.-,"; + var sValidSymbols = "$£€"; + var c; + var symbolMatch = false; - if ( typeof sData !== 'string' ) { + if ( sValidSymbols.indexOf( sData.charAt(0) ) === -1 ) { return null; } - - /* Check the numeric part */ - for ( i=1 ; i