sorting for list based on query parameter