angular-filter
angular-filter copied to clipboard
GroupBy + OrderBy doesn't order by dates in Chrome
Here's JS Bin of GroupBy + OrderBy http://jsbin.com/qewono/1/edit
A few observations:
- It only doesn't work in Chrome. In IE records ordered correctly
- It only breaks when there are many records. If you try to remove first dozen of records it orders correctly
- plain Angular's OrderBy filter works well on the same array http://jsbin.com/beciva/3/edit
@apuchkov , you should do it this way: jsbin thx
Thanks a lot!
Cheers :beers: @apuchkov
In my previous jsbin I didn't actually used dates, but strings formatted like dates.
If I put real dates, then ordering breaks http://jsbin.com/qayili/1/edit
@apuchkov I'm not sure if it's a bug.. I'll look deeply later.. for now, here's a quick fix for that: jsbin.
Cool, also for some reason Date formatting doesn't work for $key:
<h2>{{ rate.$key | date:'yyyy-MM-dd' }}</h2>
so, change the cast function to:
$scope.cast = function(arr) {
return arr.$key = new Date(arr.$key);
}
What if you want to groupBy a different variable then you want to orderBy?
I am having the same issue too. The GroupBy order shows correctly in Firefox but in Chrome it is showing in descending order.