alalonde / angular-scrollable-table

A fixed header table directive for AngularJS
MIT License
68 stars 48 forks source link

Make sorting stable #60

Closed piotr-dobrogost closed 5 years ago

piotr-dobrogost commented 7 years ago

As Array.prototype.sort is not guaranteed to be stable I think the library should guarantee stabilty itself using technique described in this anwser on Array.sort Sorting Stability in Different Browsers question on Stackoverflow.

alalonde commented 7 years ago

We could add an additional configuration input that is just a sorting function, with API e.g.

// returns a number 
function(itemA, itemB) {
  return itemA.localeCompare(itemB);
}
alalonde commented 7 years ago

If you want to put together a PR implementing this I would be happy to merge it in.

piotr-dobrogost commented 7 years ago

We could add an additional configuration input that is just a sorting function, with API e.g.

Sorry, but I don't get the idea.

alalonde commented 5 years ago

We support per-column sort comparator functions, so you should be able to just pass in your own implementation. See https://github.com/alalonde/angular-scrollable-table/blob/master/demo/index.html#L44