/** * it is not uncommon for non-english speaking countries to use a comma for a * decimal place. this sorting plug-in shows how that can be taken account of in * sorting by adding the type `numeric-comma` to datatables. a type detection * plug-in for this sorting method is provided below. * * 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 sort numbers correctly which use a comma as the decimal place. * @deprecated * @author [allan jardine](http://sprymedia.co.uk) * * @example * $('#example').datatable( { * columndefs: [ * { type: 'numeric-comma', targets: 0 } * ] * } ); */ jquery.extend( jquery.fn.datatableext.osort, { "numeric-comma-pre": function ( a ) { var x = (a == "-") ? 0 : a.replace( /,/, "." ); return parsefloat( x ); }, "numeric-comma-asc": function ( a, b ) { return ((a < b) ? -1 : ((a > b) ? 1 : 0)); }, "numeric-comma-desc": function ( a, b ) { return ((a < b) ? 1 : ((a > b) ? -1 : 0)); } } );