onclick function added for sorting list