The Pager hierarchy contains code to deal with both the retrieval of results from the backend (doQuery, getQueryInfo, etc.), and the formatting of these results (formatRow, getNavigationBuilder, etc.). The hierarchy itself is built upon this confusion:
- IndexPager
- AlphabeticPager: changes the backend (basic implementation)
- ReverseChronologicalPager: changes the backend (ordering), but also the frontend (adds header row and row groups)
- TablePager: primarily changes the frontend (turns it into a table), also slight changes to the backend (adds sortability)
It would be nice to disentangle these two aspects into separate classes: for example, leave only the backend logic in Pager / IndexPager, and introduce a separate PaginationFormatter hierarchy that deals only with the frontend aspects. This would reduce the complexity of the whole hierarchy, and make it easier to reuse logic, also giving more flexibility to the developer, by not constraining them to a specific backend + frontend preset.