Commas for decimal place

Detect numeric data which uses a comma as the decimal place.

  • Author: Allan Jardine
  • Deprecated: This plug-in has been deprecated and replaced with other functionality. Please see the detailed description below for more information.

Automatically detect numbers which use a comma in the place of a decimal point to allow them to be sorted numerically.

Please note that the 'Formatted numbers' type detection and sorting plug-ins offer greater flexibility that this plug-in and should be used in preference to this method.

Plug-in code

    function ( sData )
        var sValidChars = "0123456789,.";
        var Char;
        var bDecimal = false;
        var iStart=0;

        /* Negative sign is valid - shift the number check start point */
        if ( sData.charAt(0) === '-' ) {
            iStart = 1;

        /* Check the numeric part */
        for ( var i=iStart ; i<sData.length ; i++ )
            Char = sData.charAt(i);
            if (sValidChars.indexOf(Char) == -1)
                return null;

        return 'numeric-comma';


This plug-in is available on the DataTables CDN:


Note that if you are using multiple plug-ins, it is beneficial in terms of performance to combine the plug-ins into a single file and host it on your own server, rather than making multiple requests to the DataTables CDN.

Version control

If you have any ideas for how this plug-in can be improved, or spot anything that is in error, it is available on GitHub and pull requests are very welcome!