Sha256: 5c08259349f60dcef79854bf9c56850ae848fec33eb76aa735eeac1e84349144

Contents?: true

Size: 939 Bytes

Versions: 4

Compression:

Stored size: 939 Bytes

Contents

/**
 * This plug-in will strip out non-numeric formatting characters such that a
 * formatted number (for example 1,000,000) can be detected automatically and
 * sorted numerically. Note that characters a-z are not automatically removed,
 * otherwise there is a risk of detecting columns as numeric which should not
 * be.
 *
 * DataTables 1.10+ has formatted number type detection and sorting abilities
 * built-in. As such this plug-in is marked as deprecated, but might be useful
 * when working with old versions of DataTables.
 *
 *  @name Formatted numbers
 *  @summary formatted_numbers
 *  @deprecated
 *  @author [Allan Jardine](http://sprymedia.co.uk)
 */

jQuery.fn.dataTableExt.aTypes.unshift(
	function ( sData )
	{
		var deformatted = sData.replace(/[^\d\-\.\/a-zA-Z]/g,'');
		var isNumeric = !isNaN( deformatted - parseFloat( deformatted ) );

		return isNumeric || deformatted === "-" ?
			'formatted-num' :
			null;
	}
);

Version data entries

4 entries across 4 versions & 1 rubygems

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