tochoromero / aurelia-table

Simple functional data table for Aurelia
https://tochoromero.github.com/aurelia-table
MIT License
67 stars 25 forks source link

sort properties with mixed numeric, string, and null values #3

Closed PhilipRieck closed 8 years ago

PhilipRieck commented 8 years ago

Make sure you check this one out before accepting.

The issues I was having with the sort was this:

So what this does is alter the sort to:

  1. Make the test for numeric much more discriminating.
  2. Only compare two values as numbers if both are numbers
  3. Replace null with an empty string just before the comparison.

Please let me know your thoughts.

tochoromero commented 8 years ago

The changes are good. I like the way you are checking for numbers. The only thing I would ask you to change before merging is to pull out the isNumeric function to be a class level function, just to be consistent with my programming style. Thank you very much for your collaboration.

PhilipRieck commented 8 years ago

Good call - mixed styles are confusing. I've moved it to a class level function.