HubSpot / sortable

Drop-in script to make tables sortable
http://github.hubspot.com/sortable/docs/welcome
MIT License
1.33k stars 115 forks source link

Names with numbers being read as date #21

Closed danielocdh closed 9 years ago

danielocdh commented 9 years ago

This probably has to do with how browsers are parsing text from dates, for example on chrome Date.parse('something 1'); returns the same as Date.parse(1);

Even if you fix this, maybe it would be nice to have a way to override the column type, so we can override the type of data we want on the columns. An idea, replace "type" declaration on setupClickableTH for this:

    var type, type_override;
    type_override = th.getAttribute('data-sort_type');
    if (type_override && sortable.types.hasOwnProperty(type_override)) {
      type = sortable.types[type_override];
    } else {
      type = sortable.getColumnType(table, i);
    }
adamschwartz commented 9 years ago

Thanks @danielocdh. We elected to go the route of allowing both types to be customized and specified directly by a data- attribute on the th. Hopefully this should solve your issue as well as the many other issues people have had with types. An update to the docs will be coming shortly, but in the meantime, please check out https://github.com/HubSpot/sortable/commit/cab1613b721e7a7512417ded8fb62d163c647777 for more information. Thanks again!