persistent sorting by groups

- rather than applying the same sorting to every view, the sorting is
maintained on a per group basis. eg. all views grouped by caste will
share sorting, all views grouped by race share another sort order, etc.
role calc tweak, persistent sorting fixes

- fixes switching between views when alternating sorting on the name
column and other columns
- fixes sort order after sorting on multiple columns, and then switching
views by saving the row position, as opposed to the actual cell sort
values
- fixed the sort indicator on the column headers not showing after
applying a global sort
- updated the role calculation threshold for when min/max on the >
median values is used