mattiash / angular-tablesort

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

Sorting without default sorting is incorrect #89

Open sakae-nakajima opened 7 years ago

sakae-nakajima commented 7 years ago

The table doesn't render records as given.

This is due to the following line: https://github.com/mattiash/angular-tablesort/blob/master/js/angular-tablesort.js#L540

Print two arrays: console.log(array); console.log(arrayCopy);

You see different orders. The concat method changes the order based on $$hashKey allocated by angular.

This can be observed when you have a large set of records, than when you have a small set of records.

I ended up using track by {attr} to stop allocation of $$hashKey by angular.