Fix/paginated table sort

Closes #2270

Fixes sorting of columns. Adds test to confirm proper functionality.