Ver Mensaje Individual
  #5 (permalink)  
Antiguo 19/04/2013, 09:44
Avatar de catpaw
catpaw
 
Fecha de Ingreso: mayo-2010
Ubicación: xalapa
Mensajes: 856
Antigüedad: 14 años
Puntos: 23
Respuesta: funcion para hacer un sort numerico

hola david,

mira asi tengo la funcion:

Código Javascript:
Ver original
  1. <th field="costo_unitario" width="90" rowspan="2"
  2.     data-options="
  3.        align:'right',
  4.        formatter:formatPrice,
  5.        sorter:function(a,b){
  6.            return (parseFloat(a.replace(/[^\d.]+/g, '')) > parseFloat(b.replace(/[^\d.]+/g, '')) ? 1 : -1);
  7.        }
  8.    " sortable="true">
  9.     Costo</th>

Se supone que ya convertidos los parametros a b deberia hacer el ordenamiento numerico, pero me sigue ordenando:

Código:
$82,273.58
$8,620.00 
$7,820.00 
$6,590.22 
$6,506.84 
$6,100.00 
$56,597.35
$48,544.34
$48,416.53
$44,175.94
$3,904.10 
$3,898.50 
$21,001.24 
$20,550.72 
$2,774.00
Por que sera?