Calaca icon indicating copy to clipboard operation
Calaca copied to clipboard

Easiest way to sort

Open abresler opened this issue 9 years ago • 5 comments

trying to figure out how to modify the base code to allow for sorting of a selected numeric field in descending order. Any advice on how to best achieve that?

abresler avatar Apr 27 '15 18:04 abresler

Uses angular so you could easily build a table then use orderBy. See https://docs.angularjs.org/api/ng/filter/orderBy

romansanchez avatar Apr 28 '15 01:04 romansanchez

Any chance you could suggest a toy example that ties to elastic? Having issues trying to figure out where to put the ordering? Doesn't seem to be working in the section i'd think it belongs/

ng-repeat='result in results track by $id(result) | orderBy:"-amount"'>

Where amount is the ordering variable

abresler avatar Apr 28 '15 14:04 abresler

@abresler Maybe you have to do ordering inside elasticsearch query? I think it most reasonable.

DASAR-zz avatar Jun 03 '15 12:06 DASAR-zz

@DASAR that's possible too, but I think sorting from UI should also be possible in the case it's being used by non-technical users.

romansanchez avatar Jun 05 '15 11:06 romansanchez

Bit late to the party - but using orderBy works, except the pagination breaks it. Say you're showing 10 results per page and have 100 results in total that match, it'll show like every 10th value. Any suggestions?

JoeDylanK avatar Nov 08 '17 15:11 JoeDylanK