Better sorting

- Use global state to store sorting order (stops it from being reset
  between renders)
- Add sorting to programmes, projects and properties tables

Fixes #479