Allow fields to be sorted by orderby

3.0-unstable version of #2350
Merge pull request #2372 from jamesgol/orderbyfield-3

Allow fields to be sorted by orderby