mattiash / angular-tablesort

Sort angularjs tables easily
MIT License
184 stars 66 forks source link

parseFloat not sorting as expected if column contains negative values #105

Closed shireknight closed 6 years ago

shireknight commented 6 years ago

If I have a column that contains both positive and negative float values, the sort order is off. When sort order is descending, the negative values precede the zero values. When it's ascending, the zero values precede the negative values which precede the positive values. I wrote my own parseFloat filter filter to correct it:

.filter( 'myParseFloat', function() { return function(input) { var float = parseFloat(input); return isNaN(float) ? null : float; }; } ) <th ts-criteria="netPrem|myParseFloat">Net Prem</th>

mattiash commented 6 years ago

Merged PR #106 which should fix this.