LP#1697954: Provide client-side sorting for grids that can use it
authorMike Rylander <mrylander@gmail.com>
Wed, 14 Jun 2017 15:32:36 +0000 (11:32 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 29 Jun 2017 19:05:21 +0000 (15:05 -0400)
commitb68b2ac85d3a14a0b99cc983dc466b5c2efec12d
treea9338d53d5b7c85351b5eb8e012be4c510b49129
parentba4ee40134658d19f1f453bc5ffe6972788db3ea
LP#1697954: Provide client-side sorting for grids that can use it

There are several grids (items out, checkin, checkout, item status, etc) that
could benefit from the ability to sort their items, but either the data
provider uses a complex data structure or an API call that doesn't offer
sorting, or the item list is populated by user input rather than a call to the
server.  In those cases, sorting is not available.  However, if we know that
all the data in the grid is in client memory, it would be reasonable to offer
a client-side sort option.

This commit does that by teaching the grid to accept a "clientsort" feature
and teaching arrayNotifier how to sort the items currently stored.  The sort
works over any mix of IDL objects, hashes, and flattened fields, supports
multisort, and pushes "nulls" to the end of the list.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Andrea Neiman <abneiman@equinoxinitiative.org>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/web/js/ui/default/staff/services/grid.js