Sha256: 00dc16be32a5ccd11e9c701a5afe0391c0c4dc9f09dc471c0e34e1e50c6feca0

Contents?: true

Size: 984 Bytes

Versions: 4

Compression:

Stored size: 984 Bytes

Contents

/**
 * 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.
 *
 *  @name Commas for decimal place
 *  @summary Detect numeric data which uses a comma as the decimal place.
 *  @deprecated
 *  @author [Allan Jardine](http://sprymedia.co.uk)
 */

jQuery.fn.dataTableExt.aTypes.unshift(
	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';
	}
);

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jquery-datatables-1.10.20 app/assets/javascripts/datatables/plugins/type-detection/numeric-comma.js
jquery-datatables-1.10.19.1 app/assets/javascripts/datatables/plugins/type-detection/numeric-comma.js
jquery-datatables-1.10.19 app/assets/javascripts/datatables/plugins/type-detection/numeric-comma.js
jquery-datatables-1.10.18 app/assets/javascripts/datatables/plugins/type-detection/numeric-comma.js