Rendered hook function for sorting.