onClick method of the tables