Pure JS table sorting